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

0.1.4 -> 0.2.0 のMigrationでエラー #48

Closed
hitsub opened this issue Mar 19, 2023 · 1 comment · Fixed by #49
Closed

0.1.4 -> 0.2.0 のMigrationでエラー #48

hitsub opened this issue Mar 19, 2023 · 1 comment · Fixed by #49
Labels
bug Something isn't working

Comments

@hitsub
Copy link
Contributor

hitsub commented Mar 19, 2023

アプデ後のMigrationでEverythingを選ぶとエラーダイアログが出ました。
以後、実行毎にMigrationダイアログが出ますがEverything/PrefabOnlyどちらを選んでもエラーで止まってしまうようです。

原因が分かってないですが取り急ぎエラー内容共有です。

NullReferenceException: Object reference not set to an instance of an object
Anatawa12.AvatarOptimizer.PrefabSafeSet.EditorUtil`1+<>c__DisplayClass17_0[T].<GetElementOf>b__0 (Anatawa12.AvatarOptimizer.PrefabSafeSet.IElement`1[T] x) (at Packages/com.anatawa12.avatar-optimizer/Internal/PrefabSafeSet/Editor/EditorUtil.cs:44)
System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
Anatawa12.AvatarOptimizer.PrefabSafeSet.EditorUtil`1[T].GetElementOf (T value) (at Packages/com.anatawa12.avatar-optimizer/Internal/PrefabSafeSet/Editor/EditorUtil.cs:44)
Anatawa12.AvatarOptimizer.Migration.Migration.MigrateSet[T] (System.Collections.Generic.IEnumerable`1[T] values, UnityEditor.SerializedProperty setProperty, System.Int32 nestCount, System.Func`2[T,TResult] getValue, System.Action`2[T1,T2] setValue) (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:406)
Anatawa12.AvatarOptimizer.Migration.Migration.MigrateSet[T] (UnityEditor.SerializedProperty arrayProperty, UnityEditor.SerializedProperty setProperty, System.Int32 nestCount, System.Func`2[T,TResult] getValue, System.Action`2[T1,T2] setValue) (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:379)
Anatawa12.AvatarOptimizer.Migration.Migration.MigrateV1ToV2 (System.Int32 nestCount, UnityEditor.SerializedObject serialized) (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:307)
Anatawa12.AvatarOptimizer.Migration.Migration.MigrateComponent (Anatawa12.AvatarOptimizer.AvatarTagComponent component, System.Int32 forceVersion) (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:273)
Anatawa12.AvatarOptimizer.Migration.Migration.MigratePrefabs (System.Collections.Generic.List`1[T] prefabAssets, System.Action`2[T1,T2] progressCallback, System.Int32 forceVersion) (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:201)
Rethrow as Exception: Migrating Prefab Grus_Cardigan: Object reference not set to an instance of an object
Anatawa12.AvatarOptimizer.Migration.Migration.MigratePrefabs (System.Collections.Generic.List`1[T] prefabAssets, System.Action`2[T1,T2] progressCallback, System.Int32 forceVersion) (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:205)
Anatawa12.AvatarOptimizer.Migration.Migration.MigrateEverything () (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:142)
Anatawa12.AvatarOptimizer.Migration.Migration.DoMigrate () (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:62)
Anatawa12.AvatarOptimizer.Migration.Migration.Update () (at Packages/com.anatawa12.avatar-optimizer/Editor/Migration/Migration.cs:30)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Delegate.DynamicInvoke (System.Object[] args) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <a259d3c004024353a2c217da97495055>:0)
@hitsub
Copy link
Contributor Author

hitsub commented Mar 20, 2023

Migration.MigrateV1ToV2()において、

serialized.FindProperty(nameof(MergeSkinnedMesh.renderers)

ここでNullが混じっていると最終的にEditorUitl.GetElementOf()の引数にNullが渡されることで例外になるようです。
Prefabの作りが悪いといえばそうですが、Nullで処理が止まってしまうのはよくなさそうです。。

SS_No-00519

@anatawa12 anatawa12 added the bug Something isn't working label Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants