How do you initialise photonView in a Photon.MonoBehaviour?
Options
Comments
-
The script must be on a GameObject which in turn also has a PhotonView. Else, the photonView will be null.
Please verify you got a PV on that GO.0 -
If the object has multiple scripts that use Photon.MonoBehaviour, does it need more than one photonView?0
-
No. Multiple views could help separate stuff but in general you only need one PV to identify the GO.0
-
If each class sends RPCs, do they need PhotonViews or is that only if they use OnPhotonViewSerialize.0
-
You can call RPC from more than just one class of course.
If you want to call multiple implementations of OnPhotonViewSerialize (in many scripts) you can use more than one PhotonView or implement one OnPhotonViewSerialize to call the others. You just have to make sure the receiver knows how to read what you send.
Basically, you could totally ignore PhotonViews in Photon and come up with your own events, IDs, etc. PhotonViews just make it simpler.0