- Home /
Problems with Network.Destroy on collision.
Here is the code for my Fireball. The fireball prefab has a Network View and this script attached to it. The fireball will be destroyed fine after its lifetimer expires however if it collides with something before it dies from the timer It will not destroy immediatley and will destroy with an error when its lifetimer expires.
Error: Could'nt perform remote Network.Destroy because the netwrok view 'ID here" could not be located.
using UnityEngine;
using System.Collections;
public class Fireball : MonoBehaviour {
private float moveSpeed = 15f;
private Transform myTransform;
private float lifespan = 10f;
private int damage;
private PlayerScript PS;
void Awake()
{
myTransform = transform;
}
// Use this for initialization
void Start () {
damage = -21;
}
// 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);
}
}
void OnTriggerEnter(Collider other)
{
//PS = other.gameObject.GetComponent<PlayerScript>();
//PS.AdjustCurHealth(damage);
Network.Destroy(this.gameObject);
}
}
Couldn't perform remote Network.Destroy because the network view 'ID here" could not be located.
Answer by Bladesfist · Jan 07, 2012 at 07:18 PM
Fixed the issue by adding a RigidBody to the Fireball
Your answer
Follow this Question
Related Questions
Error destroying player over network 1 Answer
Vehicle entering network help 0 Answers
Network RPC buffer issue 0 Answers
Instantiate spawns 2 instead of 1, help? 2 Answers