I want Destroy the bullet when hit some thing , the bullet was A prefab and attached NetworkView Component
I have Use Network.Instantiate to set some bullet prefab!
the problem is when new player join the game,he will see some bullet explosion remained , but i have destroy the bullet object
the bulletshot script
me.transform.LookAt(hitTarget.point);
var i=1;
while (i<5){
yield WaitForSeconds(0.7);
//grp=Random.Range(9000,9999);
tembullet=Network.Instantiate(bullet,firePoint.position,firePoint.rotation,0);
i++;
}
audio.Play();
//*yield WaitForSeconds(5);
//rotationback();
}
the bullet Script
function Update () {
bullets.transform.Translate(Vector3.forwardTime.deltaTime170);
}
function OnTriggerEnter(other:Collider){
if (other.gameObject.tag==“enemy”){
//audio.Play();
yield WaitForSeconds(0.02);
var contact=Vector3(other.gameObject.transform.position.x,other.gameObject.transform.position.y+3,other.gameObject.transform.position.z);
Instantiate(explosionPrefab, contact, other.gameObject.transform.rotation);
Network.Destroy(GetComponent(NetworkView).viewID);
Destroy(bullets);
// Network.DestroyPlayerObjects(bullets);
print(“hit.enemy”);
}
}