I'm trying to delete an instantiated photon network obejct object once it has been collided with, however even though im I'm setting it to the object and the error returns the correct object it can't delete it for some reason and I can't figure out why here. Here is there the error :
Failed to 'network-remove' GameObject because it is missing a valid
InstantiationId on view: View (0)1 on SUV (scene). Not Destroying GameObject
or PhotonViews! UnityEngine.Debug:LogError(Object)
NetworkingPeer:RemoveInstantiatedGO(GameObject, Boolean) (at Assets/Photon
Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2499) PhotonNetwork:Destroy(GameObject)
(at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:2259)
BulletScript:OnCollisionEnter(Collision) (at Assets/Prefab/Resources/Scripts
/BulletScript.cs:29)
public Transform explosionPrefab;
private Transform explosion;
public GameObject bullet;
void OnCollisionEnter(Collision col) {
if(col.gameObject.name == "Player"){
PhotonNetwork.Destroy (col.gameObject);
Instantiate(explosionPrefab, col.transform.position, col.transform.rotation);
}
if (col.gameObject.name == "SUV") {
PhotonNetwork.Destroy (col.gameObject);
Instantiate(explosionPrefab, col.transform.position, col.transform.rotation);
}
PhotonNetwork.Destroy (bullet);
Instantiate(explosionPrefab, bullet.transform.position, bullet.transform.rotation);
}