Callback for PhotonNetwork.Instantiate
Options
I have the following code:
The main goal of this is to get the spawned object a handle of the object that spawned it. Is there a better way to accomplish this task?
Debug.Log("1"); _dmgDestroy = PhotonNetwork.Instantiate(pathTodmg + dmgDestroy.name, new Vector2(currentPos.x, currentPos.y), Quaternion.identity, 0); Debug.Log("2"); _dmgDestroy.GetComponent<Spells.Dmg_Destroy>().AwakeInstantiate(gameObject);The issue is that I want the AwakeInstantiate to be called AFTER I know the object Instantiated was spawned.
The main goal of this is to get the spawned object a handle of the object that spawned it. Is there a better way to accomplish this task?
0
Comments
-
It looks like doing a Manual Instantiation is what I need to do. https://doc.photonengine.com/en-us/pun/v2/gameplay/instantiation0
-
hi @RacerDelux,
In case you missed it, the callback for PUN instantiation isIPunInstantiateMagicCallback.OnPhotonInstantiate
. It's mentioned on that same doc link.0 -
@JohnTube
I saw that, but it does not look like it gives me a valid way to get the local photon view from the object that would have spawned the other object. I need to get a custom hook into that.0