Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

error in destroying bullet prefab

$
0
0
hi, i want to destroy bullet prefab when it is instantiated after 2 seconds and i wrote this code, but it doesn't working, and during playing mode the cloned prefabs doesn't destroyed var seconds : float =2; static var playerShooting:GameObject ; function OnCollisionEnter(other : Collision){ if(other.gameObject.name == "Player"){ Destroy(this.gameObject); } if(other.gameObject.GetComponent("Health")){ Health.enemy = playerShooting.name; Health.health -=10 ; } } function start(){ yield new WaitForSeconds(seconds); Destroy(this.gameObject); }

Viewing all articles
Browse latest Browse all 508

Trending Articles



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