4.2 Photon View Use in the Game

Asset Bundles must not contain photonview or any other photon components on any of the game objects that you load in the game. This is because in most of the cases, photon components tend to get removed and then further give Missing component error while trying to run the game (by loading asset bundle).

As mentioned in the section “Key points for multiplayer games only”, please add photon components via script to avoid further inconvenience.

For example, Use below code.

private void Awake()
       {
           if (gameObject.GetComponent<Photon.Pun.PhotonView>() == null)
           {
               gameObject.AddComponent<Photon.Pun.PhotonView>();
               gameObject.GetComponent<Photon.Pun.PhotonView>().ViewID = 26;
           }
       }

The build assetbundles options added by us, also searches for the Photon components in the database and any prefabs containing objects with the Photonview or PhotonTransform component are found then we remove their photon components.

Last updated