KybernetikGames / animancer

Documentation for the Animancer Unity Plugin.
63 stars 8 forks source link

The animancer component's inspector doesn't update continuously #309

Closed kodra-dev closed 11 months ago

kodra-dev commented 11 months ago

Environment

Description

Sorry for this rather vague bug report.

The Animancer Component's inspector UI doesn't update continuously for me. Things like state weight and clip timing don't update unless my cursor is hovering the inspector and keep moving. I know it sounds a bit crazy and weird... but that's what happens to me.

I couldn't pinpoint what causes this issue so far, but I remember in Unity 2021 the inspector keeps updating while the animation is playing.

kodra-dev commented 11 months ago

I added a log line to BaseAnimancerComponentEditor.OnInspectorGUI(), and indeed it's not called continuously. I suppose it's an issue about RequiresConstantRepaint...?

KybernetikGames commented 11 months ago

Have you got the Repaint Constantly display option enabled?

kodra-dev commented 11 months ago

Have you got the Repaint Constantly display option enabled?

image

I believe so, unless there is something I missed.

kodra-dev commented 11 months ago

Even weirder, I add this to AnimancerComponentEditor:

public override bool RequiresConstantRepaint()
        {
            Debug.Log("RequiresConstantRepaint");
            return true;
        }

However it's never called! Maybe it's a Unity bug or something...?!

KybernetikGames commented 11 months ago

Yeah, that's the option so it should be working.

I just tried it in Unity 2022.3.0f1 and it's getting called every frame.

Try importing Animancer into a new project with nothing else in it. Maybe you have something else that could be interfering with it? Odin Inspector is a common culprit.

kodra-dev commented 11 months ago

I don't have Odin Inspector or something similar tho.

A brand new project doesn't have this issue. So yeah it's probably on my side. I guess it's impossible for you to debug this without my whole project. I'll add packages one by one to see if I can pinpoint the culprit.

KybernetikGames commented 11 months ago

I just remembered another possibility: if you have 10 or more components on the same object, the Inspector seems to ignore RequiresConstantRepaint, presumably to avoid affecting performance too much.

If that's the case for you then you could just call Repaint() in OnInspectorGUI to force it to continuously repaint.

kodra-dev commented 11 months ago

I just remembered another possibility: if you have 10 or more components on the same object, the Inspector seems to ignore RequiresConstantRepaint, presumably to avoid affecting performance too much.

If that's the case for you then you could just call Repaint() in OnInspectorGUI to force it to continuously repaint.

That's exactly it! Thank you very much for the answer. I have many disabled components for debugging purpose. Didn't expect disabled ones count too...