Cant rotate clone of prefab

Hi guys

I have 4 prefabs that i can clone

Im trying to rotate the clones but it doesnt work in the transform in the inspector if i try rotation on y axis.

i also tried this in the script:

float horizontal1BottomX = Random.Range(-6F, -14f);
        Instantiate(horizontalBottomPassenger, new Vector2(horizontal1BottomX, horizontalBottomY), Quaternion.identity);
        horizontalBottomPassenger.transform.Rotate(0, 0, 180);

but i cant turn it upside down.

If you instantiate a prefab and want to work on the clone you can’t do that way because with that script you are still working on the prefab and not the clone. You have to write

var obj = Instantiate(horizontalBottomPassenger, new Vector2(horizontal1BottomX, horizontalBottomY), Quaternion.identity);
obj.transform.Rotate(0, 0, 180);

You’re trying to rotate the prefab rather than the instance.

Instantiate returns the spawned object, so you can:

GameObject spawned = Instantiate( .... );
spawned.transform.Rotate(0,0,180);

variable

var V = Instantiate(horizontalBottomPassenger, new Vector2(horizontal1BottomX, horizontalBottomY), Quaternion.identity)
V.transform.position = NowWeAreTalkingAboutTheSameObject

thats perfect thanks all!!! working great!!!