Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Can';不要因为某种原因破坏光网络对象_C#_Unity3d_Photon - Fatal编程技术网

C# Can';不要因为某种原因破坏光网络对象

C# Can';不要因为某种原因破坏光网络对象,c#,unity3d,photon,C#,Unity3d,Photon,我试图删除一个实例化的光子网络obejct对象,一旦它与它发生碰撞,然而,即使我将它设置为对象,并且错误返回正确的对象,它也无法删除它,因为某种原因,我不明白为什么在这里。以下是错误: Failed to 'network-remove' GameObject because it is missing a valid InstantiationId on view: View (0)1 on SUV (scene). Not Destroying GameObject or PhotonVi

我试图删除一个实例化的光子网络obejct对象,一旦它与它发生碰撞,然而,即使我将它设置为对象,并且错误返回正确的对象,它也无法删除它,因为某种原因,我不明白为什么在这里。以下是错误:

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);
}