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

Index out of range exception #34

Closed
SnowMser opened this issue Apr 22, 2023 · 5 comments
Closed

Index out of range exception #34

SnowMser opened this issue Apr 22, 2023 · 5 comments

Comments

@SnowMser
Copy link

no matter what settings i use i get this error

IndexOutOfRangeException: Index was outside the bounds of the array.
d4rkAvatarOptimizer+<>c__DisplayClass119_3.<CombineSkinnedMeshes>b__18 (System.Int32 i) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2531)
System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].PreallocatingToArray (System.Int32 count) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.CombineSkinnedMeshes () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2530)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:95)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:959)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
@d4rkc0d3r
Copy link
Owner

d4rkc0d3r commented Apr 23, 2023

From the looks of this error message it seems like you have a skinned mesh that is in a faulty state. Specifically one that has a mismatched amount of bones and bindposes.
To find which mesh is the culprit you can use the exclusion list.

  1. Put all skinned meshes in the exclusion list. Now it should finish the optimization without error but also don't optimize anything really.
  2. Remove 1 of the meshes and click optimize again.
  3. Repeat the previous step until the error appears again. Then you know which mesh is the problem.

Tbh I don't know how to really fix this bug as having a differently sized bindpose array from the bone array makes no sense.

@SnowMser
Copy link
Author

well even after excluding all the meshes im left with this error

IndexOutOfRangeException: Index was outside the bounds of the array.
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:1005)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

@SnowMser
Copy link
Author

Actually it spamming the console aswell with the message

@d4rkc0d3r
Copy link
Owner

For the second issue, I don't know what causes it. My best guess was meshes with 0 materials but that doesn't reproduce the error on my end.

@d4rkc0d3r
Copy link
Owner

I've added some extra guarding code without being able to reproduce the original issue. If you have time it would be nice if you could check if the problem still persists in v2.2.0
The secondary issue should be fixed in the newest version as I could reproduce it eventually.

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