Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Attacking a Prefab

$
0
0
Instantiation of a player prefab is not recognizing an Instantiated enemy prefab. void Update () { if(Vector3.Distance(transform.position, Enemy_Troop.transform.position) <100 && Vector3.Distance(transform.position, Enemy_Troop.transform.position) > 1) { transform.LookAt(Enemy_Troop.transform); transform.Translate(Vector3.forward * speed * Time.smoothDeltaTime); Debug.Log ("hit"); FightDistance = true; Fighting (); } if(health == 0) { Destroy (gameObject); } what am i doing wrong ??

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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