Will animator impact on the "SetActive"

I got a bug that Gameobject setActive does not work,at least I cannot hide the object when “SetActive(false)”

I guess that it is related to “animator” which is mounted on the Obejct. Will animator impact on “SetActive(false)”?

PS: There is no animation event in the animation.

Simple answer: No

2 Likes

If you animate the “activeness” of a GameObject, it absolutely will impact it.

To see what I mean, make an animation that blinks a cube by turning it off/on by setting “Is Active”.

Now try to write code to override it in Update() and it won’t work.

If you manipulate this property in one animation but don’t want it to affect other animations, select the animation states you don’t want it to affect and untick the “Write Defaults” box.

Here is some timing diagram help:

https://docs.unity3d.com/Manual/ExecutionOrder.html

1 Like