Hello.
I have a such problem over here.
I am using Photon Cloud.
I have a game, 4 people multiplayer.
There are spawnpoints on a level, when user enters its area - it instatiate a monster like this:
masterClientController.RPC("InstantiateMob", PhotonTargets.MasterClient, go.name, this.transform.position);
and InstantiateMob function, where I use InstantiateSceneObject, because I want a monster to stay on scene if master client will be disconnected:
[RPC]
public void InstantiateMob(string name, Vector3 CoinLocation)
{
PhotonNetwork.InstantiateSceneObject(name, CoinLocation, Quaternion.identity, 0, null);
}
Like I understand, Master Client should instantiate a gameobject in his scene, and other players should see that monster, it should be 1 monster for all 4 people. But, every user has its own monster, not common for all, other people cannot see monster on their clients. What is the problem here, what I do wrong?
Second problem is:
When I want to destroy monster GameObject from master client side( client what have created room) I get next error on another player side(usual client):
Can’t execute received Destroy request for view ID=8 as GO can’t be found. From player/actorNr: 1 GO to destroy= originating Player=2
It works the same, when I am destroying monster from usual client side, master client works fine, but usual client has the same problem.
The way how do I delete monster is further:
on moster object, what have been created in the way that I have written above, with InstantiateSceneObject on masterclient
GameMaster.GM.masterClientController.RPC("DestroyGO", PhotonTargets.MasterClient, character.GetPhotonView().viewID);
and DestroyGO method:
[RPC]
public void DestroyGO(int photonViewID)
{
PhotonView view = PhotonView.Find(photonViewID);
if (view != null)
{
PhotonNetwork.Destroy(view);
}
}
What is wrong here? Have tired a little with trying to handle it bymyself. Please help.
Thank you.