Can't get photonView when PhotonNetwork.InstantiateSceneObject

Options
hi,
I'm create a gameobject with PhotonNetwork:
object[] data = new object[2];
data[0] = index;
data[1] = _listBreak[index].IdGift;
GameObject gift = PhotonNetwork.InstantiateSceneObject("Gift", new Vector3(0f, 0f, 0f), Quaternion.identity,0,data);
and I get data in OnPhotonInstantiate with code:
object[] data = this.gameObject.GetPhotonView().instantiationData;
this.index = (int)data[0];
this.IdGift = (int)data[1];
but, sometime, it result: "Received OnSerialization for view ID 7. We have no such PhotonView! Ignored this if you're leaving a room. State: Joined" and gameobject doesn't create in other client.
Please help me, thanks!

Comments

  • Liam
    Options
    if i try:
    object[] data = photonView.instantiationData;
    or replace it to Start() own gameobject result is same.
  • Liam
    Options
    @JohnTube can you help me?
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2017
    Options
    Hi @Liam,

    I'm not familiar with this and it looks like an interesting question.
    My colleagues are on Christmas holidays now.
    You should wait until next week and maybe @Christian_Simon or @jeanfabre could help you.
  • jeanfabre
    Options
    Hi,

    Can you confirm you get this message and you are not leaving a room or attempting to play with scenes loading and unloading? if that's not the case, can you describe the time in your game when that occurs, what action did the game just do before this message pop up?

    Bye,

    Jean