Hello, i would like to know how can i instantiate an object in a random position but in selected places?

I have this object that I’m instantiating:
GameObject cubetarget = GameObject.CreatePrimitive(PrimitiveType.Cube);

And i would to make it’s position into the following:
cubetarget.transform.position = new Vector3(“Random X”, 103F, “Random Z”);

Options for X: 0, 4F, 8F, 12F, 16F.
Options for Y: 0, 4F, 8F, 12F, 16F.

Thanks :slight_smile:

You can store them in an values for X and Y in separate arrays and then use the Random.range to determine which value to be used by determining a random index for the array.