I am developing multiplayer game in unity. For multiplayer i am using photon networking library. I created room and join client successfully.
But Problem is I am doing gameobject movent by this code:
public GameObject player;
IEnumerator Moving (String temp)
{
for (int i = 0; i < 3; i++) {
player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
(Ease.Linear);
yield return new WaitForSeconds (0.5f);
}
}
DoMoveis library here.
Problem is player movement is not synchronized.
For Synchronization I add photonview component to player gameobject.
And i call coroutine though RPC like this.
player.GetComponent<PhotonView>().RPC ("Moving", PhotonTargets.All, "temp");
Accordingly i changed coroutine like this:
[PunRPC]
IEnumerator Moving (String temp)
{
for (int i = 0; i < 3; i++) {
player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
(Ease.Linear);
yield return new WaitForSeconds (0.5f);
}
}
I got this error
Illegal view ID:0 method: Moving GO:player
UnityEngine.Debug:LogError(Object)