Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

Why wont this work? (I've done similar 1000 times fine)

$
0
0
I've done this get component stuff 1000 times and its worked just fine, but its been a while so I don't remember if this is right. I would like it to work without making a public variable for the player but that wasn't working either. I am trying to access the player's script NPCDropper when the health equals Zero. and set the boolean to true. public class EnemyHealth : MonoBehaviour { public int curHP; public int maxHP; public GameObject player; void Start () { curHP = maxHP; } void Update () { if(curHP <= 0) { var npcD = player.GetComponent(); npcD.weShouldDrop = true; } } }

Viewing all articles
Browse latest Browse all 215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>