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

Optimizer failed #50

Closed
jerryzmtz opened this issue Sep 12, 2023 · 7 comments
Closed

Optimizer failed #50

jerryzmtz opened this issue Sep 12, 2023 · 7 comments

Comments

@jerryzmtz
Copy link

SDK 3.3.0
Optimizer 3.1.1

I am trying to optimize a complicated avatar with a lot of modular avatars. I do not know which one is causing the issue, I have tried to disable PB optimization, but it still fails.

InvalidOperationException: Sequence contains no elements
System.Linq.Enumerable.Max[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] selector) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.g__ConvertStateToMotion|19_1 (UnityEditor.Animations.AnimatorState s) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:226)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.b__19_8 (UnityEditor.Animations.ChildAnimatorState x) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:267)
System.Linq.Enumerable+SelectArrayIterator2[TSource,TResult].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.MergeLayers () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:267)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.Run () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:115)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.Run (UnityEditor.Animations.AnimatorController source, System.String path, System.Collections.Generic.Dictionary2[TKey,TValue] fxLayerMap, System.Collections.Generic.List1[T] layersToMerge, System.Collections.Generic.List`1[T] layersToDestroy) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:63)
d4rkAvatarOptimizer.FixAllAnimationPaths () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:1094)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:167)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:134)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

@d4rkc0d3r
Copy link
Owner

From a quick look at where it crashes I think it is caused by an animation that has no curves in it.

Disabling Optimize FX Layer will probably prevent the crash for now until I fix this.

@jerryzmtz
Copy link
Author

Thanks for your reply! But this time it fails because of....

MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Transform+Enumerator.MoveNext () (at <7d87237cea3743d093e22c5b98f74fba>:0)
d4rkpl4y3r.AvatarOptimizer.Extensions.TransformExtensions+d__0.MoveNext () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/ExtensionMethods.cs:34)
System.Collections.Generic.HashSet1[T].UnionWith (System.Collections.Generic.IEnumerable1[T] other) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.GetAllExcludedTransforms () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3978)
d4rkAvatarOptimizer.FindAllAlwaysDisabledGameObjects () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2193)
d4rkAvatarOptimizer.FindAllUnusedComponents () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2241)
d4rkAvatarOptimizer.DestroyUnusedComponents () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:4006)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:132)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:134)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

@d4rkc0d3r
Copy link
Owner

Hmm, this one looks like you have something in the exclusions list that gets destroyed. Maybe its tagged as editor only or got destroyed by another tool like MA.

@jerryzmtz
Copy link
Author

Is it possible to support editor only?

@d4rkc0d3r
Copy link
Owner

yeah I will fix this for the next release. I just wanted to tell you that in the meanwhile you can circumvent the crash by removing whatever it is from the exclusion list. excluding something from optimization that will get deleted anyways doesn't really change anything.

@jerryzmtz
Copy link
Author

Thanks for you reply! This happens because I am using modular avatar where I do not one to delete parts of the prefab. So I mark them as editor only. However, the rest of the prefab still includes materials that could not be parsed. That is why this issue happens

@d4rkc0d3r
Copy link
Owner

both issues should be fixed in 3.1.2 now

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