Hello, when I try to Instantiate a gameobject everything works. but the rotation remains a flat 0,0,0. Why is it happening?
GameObject spawnedEnemy = Instantiate(EnemyPrefab, point, Quaternion.Euler(0f, 180f, 0f));
Setting the rotation this way definitely works, something else must be interfering.
Two explanations I can think of:
- Something else is overwriting the rotation, e.g. if a script sets the rotation in
Awake,OnEnableorStart, you won’t be able to see the initial rotation set beInstantiate. - The rotation you pass to
Instantiateis global but the inspector shows you the local rotation. If you reparent the game object after instantiation, its local rotation might be (0,0,0) but its global rotation still (0,180,0).
Let me add a third common one:
- the item has an animation that orients it