Answer the question
In order to leave comments, you need to log in
How to cast int to object[]?
PUN2 uses object[] to pass a value to the created prefab (see data in Instantiate). This is how I try to pass the command number to the unit prefab:
object[] data = new object[2];
void Push(object o) { data[myTeam++] = o; }
Avatar = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "Avatar0"),
GameSetUp.GS.spawnPoints[1].position,
GameSetUp.GS.spawnPoints[1].rotation, 0, data);
public void OnPhotonInstantiate(PhotonMessageInfo info)
{
object[] instantiationData = info.photonView.InstantiationData;
objects = instantiationData;
}
Answer the question
In order to leave comments, you need to log in
Is there an example of calling Push(object o)? The code that is written above does not fill in data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question