0
Fixed

Bolt almost unusable on 2018.2.0x Improved Prefabs Beta

HyenaGames Dev 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 12

I'm trying to use Bolt 1.4 on the Unity Beta for Improved Prefabs and getting all sorts of errors. I can't even open the Bolt Preferences Window most of the time. and the times it does open, changes to the configuration don't save. 


UnityException: get_unityPreferencesFolder can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEditor.FilePathAttribute..ctor (System.String relativePath, Location location) (at C:/buildslave/unity/build/Editor/Mono/ScriptableSingleton.cs:31)
System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoCustomAttrs.cs:108)
System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoCustomAttrs.cs:151)
System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoType.cs:595)
System.Attribute.GetCustomAttributes (System.Reflection.MemberInfo element, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:265)
Ludiq.AttributeUtility+AttributeCache..ctor (System.Reflection.MemberInfo element) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/AttributeUtility.cs:48)
Ludiq.AttributeUtility.GetAttributeCache (System.Reflection.MemberInfo element) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/AttributeUtility.cs:217)
Ludiq.AttributeUtility.HasAttribute[InspectorAttribute] (System.Reflection.MemberInfo element, Boolean inherit) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/AttributeUtility.cs:288)
Ludiq.SingleDecoratorProvider`3+<>c[Ludiq.Metadata,Ludiq.Inspector,Ludiq.InspectorAttribute].<mapattributetypes>b__9_0 (System.Type t) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Interface/EventWrapper.cs:32)
System.Linq.Enumerable+<createwhereiterator>c__Iterator1D`1[System.Type].MoveNext ()
Ludiq.SingleDecoratorProvider`3[TDecorated,TDecorator,TAttribute].MapAttributeTypes () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Interface/DragAndDrop/DragAndDropUtility.cs:38)
Ludiq.SingleDecoratorProvider`3[TDecorated,TDecorator,TAttribute]..ctor () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Interface/DragAndDrop/DragAndDropUtility.cs:20)
Ludiq.InspectorProvider..ctor () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Meta/Metadata.cs:701)
Ludiq.InspectorProvider..cctor () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Meta/Metadata.cs:673)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Ludiq.InspectorProvider
Ludiq.XInspectorProvider.HasInspector (System.Type type) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Meta/Metadata.cs:754)
Bolt.UnitBase+<gettypeoptions>d__12.MoveNext () (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Editor/Options/UnitBase.cs:512)
Bolt.UnitBase+<getincrementaloptions>d__11.MoveNext () (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Editor/Options/UnitBase.cs:489)
System.Linq.Enumerable+<createselectmanyiterator>c__Iterator12`2[System.Type,Bolt.IUnitOption].MoveNext ()
System.Collections.Generic.HashSet`1[Bolt.IUnitOption]..ctor (IEnumerable`1 collection, IEqualityComparer`1 comparer)
System.Collections.Generic.HashSet`1[Bolt.IUnitOption]..ctor (IEnumerable`1 collection)
Bolt.UnitBase.Update () (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Editor/Options/UnitBase.cs:307)
Bolt.UnitBase.Load () (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Editor/Options/UnitBase.cs:57)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:104)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:215)</createselectmanyiterator></getincrementaloptions></gettypeoptions></createwhereiterator></mapattributetypes>
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Hi Hyena! This seems like a Unity bug.

Are all the errors with get_unityPreferencesFolder related to the FilePathAttribute..ctor? (See line 4 in the stack trace you posted).

If so, I can probably submit a concise bug report to Unity, or better yet, something directly on the beta forum.

I think they were all related! However, I'm having trouble reproducing at this time. Suddenly Bolt is allowing me to open the configuration window again without error. It's still not saving the settings right, but that's being handled on the other report.

Unity Bug

Hi Hyena! Glad you got it somehow working in the mean time.

So I isolated & reported the get_unityPreferencesFolder bug. It is indeed from something in the Unity source, but I added an error check that should minimize it to a warning in the next version.

I unfortunately don't have the time to test & debug Bolt on experimental Unity builds such as the prefabs beta. If you have further issues, please paste the entire stack trace so I can try to isolate them from there.

Hey Lazlo I know you're not actively working on experimental stuff but I wanted to throw this here for the 2018.3 experimental that has the improved prefabs.  I'm getting this constantly when I have a prefab view open.  I was trying to trace it through to see if I can pinpoint and help you more but I don't kow the inner workings of Unity as well

MissingMethodException: UnityEngine.Object UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(UnityEngine.Object)
Ludiq.EditorUnityObjectUtility.IsPrefabInstance (UnityEngine.Object uo) (at <6b4d220ee84c400b8fee04e0d2baab14>:0)
Ludiq.EditorUnityObjectUtility.IsConnectedPrefabInstance (UnityEngine.Object go) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Editor/Interface/Icons/Icons.cs:497)
Ludiq.GraphContext`2[TGraph,TCanvas].get_isPrefabInstance () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Context/GraphContext.cs:120)
Ludiq.GraphContext`2[TGraph,TCanvas].BeginEdit (System.Boolean disablePrefabInstance) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Context/GraphContext.cs:136)
Ludiq.GraphWindow.OnGUI () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Windows/GraphWindow.cs:456)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>: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 <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:335)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:329)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:303)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:360)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:319)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:244)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Working on Fix

Hey Nolic! Thanks for the report. That's definitely a core change in how prefabs are handled. I'll have to rework my entire prefab utility to account for the Unity version. The main problem I foresee though is that because Bolt ships as DLLs, we can't use conditional version defines. So I'll have to be clever about it!

To be clear: I'll make sure Bolt works with 2018.3, but I can't focus my efforts on experimental builds. 

Oh yeah I totally get that :)  Just wanted to update this thread because you had mentioned to the OP about posting other stuffs :)

Other than the fact that Flow Machines, State Machines, and Variables don't show up and Generating Documentation fails the errors that are thrown don't stop development...in areas other than bolt ;p

Hi Nolic,

Sorry for the very late reply on this, busy month!

It just occurred to me that Unity should have warned you about obsolete APIs when importing Bolt. Did you allow it to automatically upgrade the Bolt DLLs? If you chose "No thank you" or something like that, then the obsolete prefab API calls won't get fixed, hence the errors you're getting.

Fixed in Next Version

Actually, I found the two prefab methods that were obsoleted and added reflection fallbacks for them in 2018.3+ for v.1.4.0f10, so it should fix the issue. Thankfully Bolt only uses these two methods to deal with prefabs. Let me know if f10 works for you!

+1

Looking pretty good so far!  Haven't had a chance to really dive into flow machines and whatnot but it looks like my state machines and variable components are loading up properly!

Also to answer your first question pretty sure I said to upgrade DLLs (or anything for that matter) if I had gotten the prompt...but I don't honestly recall if I did!

Sorry for the delayed response, busy with my head down busting out code over here too :)