Hi,
I want to instantiate a crate randomly on the x and z axis and my code works, but not with photon. So none of the players see the same instantiation:
IEnumerator CrateDrop()
{
while (crateCount < 200)
{
xPos = Random.Range(50, 390);
zPos = Random.Range(50, 390);
Instantiate(crate, new Vector3(xPos, 26, zPos), Quaternion.identity);
yield return new WaitForSeconds(15);
crateCount += 1;
}
}
This is the working code without photon. and this is how I tried to write it with photon instantiation:
IEnumerator CrateDrop()
{
while (crateCount < 200)
{
xPos = Random.Range(50, 390);
zPos = Random.Range(50, 390);
PhotonNetwork.Instantiate(crate.name, new Vector3(xPos, 26, zPos), Quaternion.identity);
yield return new WaitForSeconds(15);
crateCount += 1;
}
}
On play there’s an error:
NotImplementedException: The method or operation is not implemented.
PhotonNetwork.Instantiate (System.String v, UnityEngine.Vector3 position, UnityEngine.Quaternion identity) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:55)
CrateSpawner+c__Iterator0.MoveNext () (at Assets/Crates/CrateSpawner.cs:51)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
CrateSpawner:Start() (at Assets/Crates/CrateSpawner.cs:22)
Does anybody know what the error means and how to instantiate the crate randomly within the x and z paramters above correctly?