enter code hereIm making a co-op game using photon unity networking and I’ve run into an issue while making a restart function that not even google could solve for me or give me any insight.I am using unity’s new UI to call OnRestartPressed() and everything seen here is in one c# script.
This is the Error i get:
Illegal view ID:0 method: RestartMatchRPC GO:Heli_MP2
And on the other client when connected and the RPC is called i get this:
Received RPC "RestartMatchRPC" for viewID 0 but this PhotonView does not exist! Was remote PV. Remote called. By: 1 Maybe GO was destroyed but RPC not cleaned up.
And this is the part of code responsible for this mess:
[RPC]
void RestartMatchRPC(){
Time.timeScale = 1f;
isPaused = false;
myNetworkManager = GameObject.FindObjectOfType<NetworkManager>();
PhotonNetwork.DestroyAll();
myNetworkManager.OnJoinedRoom();
Debug.Log ("RestartMatchRPC");
}
public void OnRestartPressed(){
isPaused = false;
Time.timeScale = 1f;
if (Application.loadedLevel !=1) {
photonView.RPC ("RestartMatchRPC", PhotonTargets.Others);
} else {
Application.LoadLevel(1);
}
}