Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FX optimizer doesn't handle synced layers correctly #138

Open
TheMrGong opened this issue Dec 21, 2024 · 2 comments
Open

FX optimizer doesn't handle synced layers correctly #138

TheMrGong opened this issue Dec 21, 2024 · 2 comments

Comments

@TheMrGong
Copy link

Came across an avatar from booth utilizing the animator's Synced layer's feature

Because synced layers have an empty state machine and are meant to reference the target layer and only provide override animations, the optimizer incorrectly assumes it's an empty layer

For reference, here is how Modular Avatar handles synced layers:

https://github.com/bdunderscore/modular-avatar/blob/main/Editor/Animation/AnimatorCombiner.cs#L487-L488

@d4rkc0d3r
Copy link
Owner

I tried fixing it with 3.9.3.
However I don't know anything about synced layers nor do I have any test case for them. Please test if this fix actually works for your use case.

@TheMrGong
Copy link
Author

@d4rkc0d3r While it now correctly references the target sync layer, it does not copy over the override states

A synced layer is the layer-equivalent to Animator Controller Overrides - when you set a layer to be synced with another, it no longer has its own state machine and instead references the target layer's. Instead it uses its builtin list of Motions and Behaviours to override the ones in the target layer

(here, EyestalkFace is a synced layer targeting Face)
image
^- If you'd like this view for yourself, you can use unity's Debug Internal mode - it's enabled by typing internal into Help > About Unity
image

Modular Avatar's solution is to iterate through all of the states in the target layer, call AnimatorControllerLayer.GetOverrideMotion, clone it, then reassign it via AnimatorControllerLayer.SetOverrideMotion - it does similar for behaviours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants