OnTriggerEnter() Network.Destroy problem

I have a script that instantiates fireballs into the game and a script that updates the fireballs, The fireballs are killed fine if they are left to die from there lifespan reaching 0. However if the trigger method is called the fireball is not killed instantly and dies after its lifespan reaches 0 with an error: Could’nt perform remote Network.Destroy because the netwrok view 'ID here" could not be located.
Here is how the fireball is instantiated:

using UnityEngine;
using System.Collections;

public class Mage : MonoBehaviour {
	
	public GameObject fireball;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	if(Input.GetMouseButtonDown(0))
		{
			Network.Instantiate(fireball, transform.position + transform.forward, transform.rotation, 0);
		}
	}
}

and here is how they are updated

using UnityEngine;
using System.Collections;

public class Fireball : MonoBehaviour {

	private float moveSpeed = 15f;
	private Transform myTransform;
	private float lifespan;	
	private int damage;
	private PlayerScript PS;
	
	void Awake()
	{
		myTransform = transform;
	}
	// Use this for initialization
	void Start () {
	damage = -21;
	lifespan = 10f;
	}
	
	// Update is called once per frame
	void Update () {
	myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
		
		lifespan -= Time.deltaTime;
		if(lifespan < 0)
		{
			Network.Destroy(this.gameObject);
			Destroy(this.gameObject);
		}
	}
	
	void OnTriggerEnter(Collider other)
	{   	
		//PS = other.gameObject.GetComponent<PlayerScript>();
		//PS.AdjustCurHealth(damage);
		networkView.RPC("Kill", RPCMode.All);		

	}
	
	[RPC]
	void Kill()
	{
		Network.Destroy(this.gameObject);
	}
}

Does anyone know what the problem is and why it only occurs if the fireball has collided?

Do you spawn this object with Network.Instantiate? It looks like the object is missing on the other client.

can you go
if(ID)
?

I showed the script that instantiates them in opening post.

Im not sure I understand, wait im guessing that is unity script and you mean I should do if(!ID == null)?

I have no idea really but something like if (ID.gameObject!=null)
er, ignore me, heh, drunken coding inspirations, lol enjoy your work :wink:
AC

Im trying too but this error is denying me of all happyness

Haven’t really worked with the Network or C#,but I’m kinda having a hard time understanding why you have two methods (or functions or whatever they were called in C#) for the destruction of the object.I mean the following:

void OnTriggerEnter(Collider other)
	{   	
		networkView.RPC("Kill", RPCMode.All);		
	}
	
	[RPC]
	void Kill()
	{
		Network.Destroy(this.gameObject);
	}

I have no idea what that networkView is or what RPC is, but can’t you simply do this? :

void OnTriggerEnter(Collider other)
	{   	
		Network.Destroy(this.gameObject);
	}

Sorry for not being very helpful… :confused:

Your right I could (and should). I only put the RPC call in there for debugging purposes however I have fixed this issue by adding a rigidbody to my fireball.