Cannot change rotation if prefab contains animation that affects rotation

I encountered a strange problem.

There is a prefab. On instantiation a rotation is set to the object.
Prefab has an animator and an animation that changes rotation during gameplay.

After instantiating the object I cannot change rotation from script if there is an animation that affects rotation. Even if it just there, in state machine without any transitions to it. Even if animation has only one frame.
Rotation is stuck to the one set on instantiation.

Here is more details.


InstObject = (GameObject)Object.Instantiate(Prefab_Obj, new Vector3(PositionX, PositionY, 0), Quaternion.Euler(0f, 0f, DefaultZRotation));

Animator already on object. It has an empty default state and a rotation animation (without transition to it). 59204-screenshot-1.jpg

I change rotation through transform:

InstObject.transform.rotation = Quaternion.identity;


Since this is no longer a mystery - I created a more distinct question and this topic will be closed:

I’ve had the same problem while using the plugin to film a scene (I don’t remember the name…).

I couldn’t use the transform.position.rotation so I used the Rotate() function. One of this two may function for you. It can also be due to the configuration of your Rigidbody.

I tested this on empty scene and posted a new question with more details and a package: