Runtime PhotonView components

So I have a ton of prefabs and content that is loaded from assetbundles and I wish to keep track of their state. Is it possible to add PhotonView components etc at runtime after being instantiated? If not what is a workaround for this?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Ayfel,

    Thank you for choosing Photon and sorry for the long delay!

    In order to be synchronized over the network, PUN requires GameObject with PhotonView components to be created using one of the following 4 methods:

    - PhotonNetwork.Instantiate
    - PhotonNetwork.InstantiateSceneObject
    - GameObject with PhotonView already in the scene
    - Manual instantiation

    If you want to sync. a GameObject with PhotonView dynamically added at runtime, it's not recommended and could be a lot of trouble.
    Unless the use case really requires this, use one of the methods supported out of the box.