Quantcast
Viewing all articles
Browse latest Browse all 54

Answer by Pharaoh_

Attach a script on your colliders and make a GUIScriptName gSN variable. OnTriggerEnter(), check the tag of the collider (let's call it col). If col.gameObject.tag == "Enemy" then access the coordinates of your GUI element (coordinates/ fill amount/ text display - anything you're using). e.g. if (gSN.myHealth - damage > 0) { gSN.myHealth -= damage; } else { //dead } In the GUI script, your e.g. GUIText will be displaying the current health of your player, so it will already be updated on the next frame.

Viewing all articles
Browse latest Browse all 54

Trending Articles



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