SolidAlloy / GenericUnityObjects

Generic UnityEngine.Objects
Other
167 stars 13 forks source link

Can't create generic scriptable object #14

Closed cuikeqiang closed 3 years ago

cuikeqiang commented 3 years ago

Hello, 2 Error messages showed after I created a generic scriptable object. 【Error1】 NullReferenceException: Object reference not set to an instance of an object UnityEditor.EditorStyles.get_toolbar () (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/EditorStyles.cs:196) UnityEditor.ObjectListArea+Group..ctor (UnityEditor.ObjectListArea owner, System.String groupTitle) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ObjectListGroup.cs:12) UnityEditor.ObjectListArea+LocalGroup..ctor (UnityEditor.ObjectListArea owner, System.String groupTitle, System.Boolean showNone) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ObjectListLocalGroup.cs:81) UnityEditor.ObjectListArea..ctor (UnityEditor.ObjectListAreaState state, UnityEditor.EditorWindow owner, System.Boolean showNoneItem) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ObjectListArea.cs:162) UnityEditor.ProjectBrowser.Init () (at /Users/bokken/buildslave/unity/build/Editor/Mono/ProjectBrowser.cs:447) UnityEditor.ProjectBrowser.BeginPreimportedNameEditing (System.Int32 instanceID, UnityEditor.ProjectWindowCallback.EndNameEditAction endAction, System.String pathName, UnityEngine.Texture2D icon, System.String resourceFile) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ProjectBrowser.cs:2635) UnityEditor.ProjectWindowUtil.StartNameEditingIfProjectWindowExists (System.Int32 instanceID, UnityEditor.ProjectWindowCallback.EndNameEditAction endAction, System.String pathName, UnityEngine.Texture2D icon, System.String resourceFile) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ProjectWindow/ProjectWindowUtil.cs:601) UnityEditor.ProjectWindowUtil.CreateAsset (UnityEngine.Object asset, System.String pathName) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ProjectWindow/ProjectWindowUtil.cs:251) GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator+<>cDisplayClass1_0.b1 (UnityEngine.ScriptableObject asset) (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:43) GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator.CreateAssetFromConcreteType (System.Type concreteType, System.Action`1[T] saveAsset) (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:132) GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator+<gCreateAssetImpl|1_0>d.MoveNext () (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:43) UnityEngine.Debug:LogException(Exception) Cysharp.Threading.Tasks.UniTaskScheduler:PublishUnobservedTaskException(Exception) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTaskScheduler.cs:90) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskVoidMethodBuilder:SetException(Exception) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs:53) GenericUnityObjects.Editor.ScriptableObjects.<gCreateAssetImpl|1_0>d:MoveNext() (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:48) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskVoid1:Run() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/StateMachineRunner.cs:104) Cysharp.Threading.Tasks.AwaiterActions:Continuation(Object) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTask.cs:21) Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1:TrySetResult(AsyncUnit) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTaskCompletionSource.cs:139) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask1:SetResult() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/StateMachineRunner.cs:204) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder:SetResult() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs:70) GenericUnityObjects.Editor.ScriptableObjects.<WaitUntilEditorInitialized>d__3:MoveNext() (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:84) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask1:Run() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/StateMachineRunner.cs:189) Cysharp.Threading.Tasks.AwaiterActions:Continuation(Object) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTask.cs:21) Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(AsyncUnit) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTaskCompletionSource.cs:139) Cysharp.Threading.Tasks.NextFramePromise:MoveNext() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTask.Delay.cs:342) Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:RunCore() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/Internal/PlayerLoopRunner.cs:175) Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:Update() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/Internal/PlayerLoopRunner.cs:145) Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:Run() (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/Internal/PlayerLoopRunner.cs:104)

【Error2】 CreateAssetFromConcreteType was most likely called too early. Add it to EditorApplication.delayCall instead. UnityEngine.Debug:LogError (object) GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator:CreateAssetFromConcreteType (System.Type,System.Action1<UnityEngine.ScriptableObject>) (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:128) GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator/<<FinishSOCreationInteractively>g__CreateAssetImpl|1_0>d:MoveNext () (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:43) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskVoid1<GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator/<g__CreateAssetImpl|1_0>d>:Run () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/StateMachineRunner.cs:104) Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTask.cs:21) Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1<Cysharp.Threading.Tasks.AsyncUnit>:TrySetResult (Cysharp.Threading.Tasks.AsyncUnit) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTaskCompletionSource.cs:139) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask1<GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator/d3>:SetResult () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/StateMachineRunner.cs:204) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder:SetResult () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs:70) GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator/d3:MoveNext () (at Library/PackageCache/com.solidalloy.generic-unity-objects@2.5.0/Editor/ScriptableObjects/GenericSOCreator.cs:84) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask1<GenericUnityObjects.Editor.ScriptableObjects.GenericSOCreator/<WaitUntilEditorInitialized>d__3>:Run () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/CompilerServices/StateMachineRunner.cs:189) Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTask.cs:21) Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1:TrySetResult (Cysharp.Threading.Tasks.AsyncUnit) (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTaskCompletionSource.cs:139) Cysharp.Threading.Tasks.UniTask/NextFramePromise:MoveNext () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/UniTask.Delay.cs:342) Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:RunCore () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/Internal/PlayerLoopRunner.cs:175) Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:Update () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/Internal/PlayerLoopRunner.cs:145) Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:Run () (at Library/PackageCache/com.cysharp.unitask@2.2.5/Runtime/Internal/PlayerLoopRunner.cs:104)

SolidAlloy commented 3 years ago

Hello, thanks for reporting the issue. Could you check it in the new 2.6.0 version?