Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

Collision Detection not working?

$
0
0
Trying to make it so when the player collides with the Jetpack item it sets the playerpref for the jetpack to 1, then destroys the jetpack. But I can't seem to make the jetpack disappear. OnTriggerEnter would be fine too, I just need the jetpack to disappear. using UnityEngine; using System.Collections; public class JetpackPickup : MonoBehaviour { public int doIHaveJetpack = 0; void OnCollisionEnter(Collision other) { if(other.collider.name == "Player") { PlayerPrefs.SetInt("doIHaveJetPack", 1); Destroy(other.gameObject); } } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles