Instantiate putting object at original's position

I debugged the positions assigned and it works fine. The only clue I can think of is that the original cube is in the game and they are spawning at the original.

void Start () {
		int CubeSpawns = Random.Range (1, 321);
		for (int CubesSpawned = 0; CubesSpawned < CubeSpawns + 1; CubesSpawned ++)
		{
			int XPos = Random.Range (-80, 81);
			int YPos = Random.Range (-80, 81);
			Debug.Log (XPos);
			Instantiate (CubeGet, new Vector3 (XPos, YPos, 1), Quaternion.identity);
		}
	}

You code is working well, I don’t see any problem in it (I tested it),
Maybe it’s just your environment setup so i’ll guide you through it.

Make your cube a prefab and delete if from the Hierarchy (it’s not in the project panel).

In your code, reference the prefab in a gameObject.

Now when you instantiate it, the prefab will be created and placed at the random position (note that -80, 81 is a huge range) so you need to zoom out to see all of the instantiated cubes.

Hope that works (Answers your question) :slight_smile: