Error: EV Destroy Failed. Could not find PhotonView with InstantiateID XXX

Options
Hello,

I am going bananas with this, hopefully somebody can assist.

OS: WIn 10 running Unity 2017.4.301f
Photon PUN 2
Target Platform PC

I have photon quick setup working, everything works great with room, connectioons, players, transforms, etc.

Here is my logic overview:
Network Controller connects to master.
Then the room controller Creates/Join random room, and instantiates a PhotonPlayer.
PhotonPlayer Calls it's own function to respawn Avatar after a ship is selected (from a UI element).
Player Avatar checks his health, and if he hits 0, he calls his own PhotoPlayer to KillAvatar


Everything works fine as a single user in the room.
Once another joins, it also works fine, but unity editor consol throw out this error:

Ev Destroy Failed. Could not find PhotonView with instantiationId 2499. Sent by actorNr: 2

This is the Error in the log File:
Ev Destroy Failed. Could not find PhotonView with instantiationId 2499. Sent by actorNr: 2
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Photon.Pun.PhotonNetwork:OnEvent(EventData) (at Assets\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:2152)
Photon.Realtime.LoadBalancingClient:OnEvent(EventData) (at Assets\Photon\PhotonRealtime\Code\LoadBalancingClient.cs:2826)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer) (at C:\Dev\photon-sdk-dotnet\PhotonDotnet\PeerBase.cs:656)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:\Dev\photon-sdk-dotnet\PhotonDotnet\EnetPeer.cs:549)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:\Dev\photon-sdk-dotnet\PhotonDotnet\PhotonPeer.cs:1598)
Photon.Pun.PhotonHandler:Dispatch() (at Assets\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:205)
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:139)


PhotonPlayer has only two functions:
ReSpawnAvatar() - spawns the avatar under player control
KillAvatar() - kills the avatar under player control
Here is my code on the PhotonPlayer:
using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;

public class PhotonPlayer : MonoBehaviour {


	//Manages Spawning and Respawning of network avatar for this networkplayer
	private PhotonView PV;
	public string selectedAvatar;   //Spawns avatar based on value of selectedAvatar
	public GameObject myAvatar;
	public WindowSlider shipSelectScreen;


	void Start () {

		PV = GetComponent<PhotonView> ();

	}


        //When game start UI is displayed, they pick a ship, and then that UI call this function
        //sets the string of the Avatar file to load
	public void AssignShip (string shipFilename) {

		//called by ship select buttons
		selectedAvatar = shipFilename;

	}

	public void ReSpawnAvatar () {
	
		//Pick random from length of spawn points list
		int spawnPicker = Random.Range (0, GameSetup.GS.spawnPoints.Length);

		//Create my avatar
		if (PV.IsMine) {

                         //instantiate my selected avatar at a random spawn point from GameSetup.GS

			myAvatar = PhotonNetwork.Instantiate ( Path.Combine ("PhotonPrefabs", selectedAvatar),

				GameSetup.GS.spawnPoints [spawnPicker].position, 
				GameSetup.GS.spawnPoints [spawnPicker].rotation, 0);

			//We will tell it to connect to me, as their parent for self destruction
			//because I will handle spawn and respawn
			MultiplayerFlightControls tmp = myAvatar.GetComponent<MultiplayerFlightControls>();

			//Tell the new ship, that I am it's creator, so he can tell me when to kill him for death/respawn
			tmp.myPhotonPlayer = this;

		}

	}

	public void KillAvatar() {

		if (PV.IsMine) {

			if (myAvatar != null) {


				//Do a player EXPLOSION
				PhotonNetwork.Instantiate (Path.Combine ("PhotonPrefabs", "NetworkPrefabPlayerExplosion"), myAvatar.transform.position, Quaternion.identity, 0);

				//Remove my avatar from all clients
				PhotonNetwork.Destroy (myAvatar);

			}

		}

	}


}


And here is the code on the Player Avatar, this is within a class MultiPlayerFlightControls, used to control the player.
This is the only place where it tells the PhotonPlayer to kill it. This class already has access to the PhotoPlayer tied with this instance of the flight controlle, via myPhotonPlayer..

     void Update() {

          if(health <=0) {

             TimeToDie();

          }

     }


	public void TimeToDie() {

		//Called if health = 0

                //PV is predefined in Start() as my own PhotonView;
		if (PV.IsMine == true) {

			if (dieOnce == false) {

				//Tell it to delete avatar
                               //myPhotonPlayer is setup when I am instantiated by PhotoPlayer.
				myPhotonPlayer.KillAvatar ();

				dieOnce = true;


			}

		}
	
	}


There are no other coillisions, projectiles or anything attempting to call this TimeToDie() function.
The spawn respawn die works flawlessly on single player, and multiplayer as well.
But I dont like seeing Unity consol errors.

The Error sounds like server or clients are trying to delete the same item that has been deleted by the owner.
I get the same errors when all items are Unreliable, OR Unreliable On Change.

Since only the owner of the object can call it's own PhotonPlayer's KillAvatar(), (they are assigned when Avatar is spawned), why am i getting this error? Any help would be great!

Comments

  • EBones
    Options
    I did want to mention, that I get more of the same errors on consol, when Unreliable on change is used. This might indicate something that might help, to somebody more experienced that myself.
  • EBones
    Options
    Nobody has seen this since Unity 5 stuff on the web? Would really love to start moving forward again with this project...
  • EBones
    Options
    I haven't heard from support in 4 days, how do I escalate this issue please?
    I resolved this issue, in case anyone needed to know. I was network instantiating bullet since this was a first test project. This was caused by a bulklet still existing, after the actor/creator got destroyed.

    This went away when I switched to RPC bullet calls.