How to use object[] property on Instantiate

Options
Im having difficulty accessing information about objects spawned on the PhotonNetwork. I see that the PhotonNetwork.Instantiate has a 5th property called "object[] data". According to the documentation "data Optional instantiation data. This will be saved to it's PhotonView.instantiationData." which basically sounds like exactly what I need/

BUT, the issue is I don't quite understand how to implement, access, or store the values in this field. I don't recognize the phrasing, how do I use this correctly? Thanks!

Comments

  • Tobias
    Options
    The doc is not very extensive. I could potentially write something more these days.
    I hope this helps:
    When you instantiate something, you can pass additional parameters with this instantiate "event". Those stick with the GameObject and are accessible by the GO's PhotonView. Along with the PhotonView, add a script to the prefab. Implement Start() or Awake() and you should be able to access the creator's parameters via the GO's photonView.instantiationData.

    Try it out by passing a single string to Instantiate, then access it when the Obj gets created on the remote clients.