Hello!
In my little script I created a Vector3 array to assign random spawnPoints:
public Vector3[] spawnPoints;
(even this little line of code gives me an error sometimes: System.Numerics.Vector3 or Unity.Engine.Vector3? - Ambiguous!)
Then I wrote something like this:
private void CreatePlayer()
{
int NumeroSpawnPoints = spawnPoints.Length;
int RandomSpawnPoint = Random.Range(0, NumeroSpawnPoints);
switch (RandomSpawnPoint)
{
case 0:
UnityEngine.Vector3 posizione = spawnPoints[0];
break;
case 1:
UnityEngine.Vector3 posizione = spawnPoints[1]);
break;
case 2:
UnityEngine.Vector3 posizione = spawnPoints[2];
break;
}
But it does not work …
How can I assign a Vector3 value that I can later use on an Instantiate?
My Idea was to pick a random Vector3 and assign it to “posizione” and then use something like
PhotonNetwork.Instantiate(Path.Combine("Personaggio3", "3"), posizione, Quaternion.identity, 0);
How can I achieve this?
Thanks for your help! (I will be back to my computer in 12H so I can’t try right now!)
P.s.
How can I also get rid of that “ambiguous” error?
Do I have to code it like
UnityEngine.Vector3
?