Photon view id became 0 and RPC not found when the gameobject was made as prefab

Options
I m using unity 2019.1, A two player multiplayer game
everything was working fine when the gameobject was just a empty gameobject in the scene
It had view id.
I made that empty gameobject a prefab, where photonView is attached and Rpc function script is attached.
Now the prefab shows the view id as "SET AT RUNTIME". And in the run time when prefab is spawned and then the View ID shows as 0 and It pops up error saying View ID is 0 and RPC not found

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2019
    Options
    Hi @deepak,

    Thank you for choosing Photon!

    How do you instantiate the prefab?
    You need to do it using PhotonNetwork.Instantiate and not UnityEngine.Object.Instantiate.
    Read more here.