Quantcast
Channel: Latest Questions by 07Mr07
Viewing all articles
Browse latest Browse all 59

Get valor of variable in another script

$
0
0
Hi, I have two scripts, health.js var health = 100f; var enemy : GameObject; function OnTriggerEnter (bullet : Collider) { Debug.Log(health); if (bullet.gameObject.CompareTag("bullets")){ vida -=1; Destroy(Bala.gameObject); if (vida <=0) { Destroy(Enemigo,0f); } } } and hpbar.js for health bar. var target : Transform; function Update () { var wantedPos = Camera.main.WorldToViewportPoint (target.position); transform.position = wantedPos; } And I need valor of health variable in health.js on hpbar.js for decrease the health bar. Help pls! :)

Viewing all articles
Browse latest Browse all 59

Latest Images

Trending Articles



Latest Images