Can Behavior Designer be moved into an Assembly?

Zaddo

Active member
Is there a reason Behavior Designer is not in its own Assembly? Would making this change to my project possibly result in unexpected behaviour with Behavior Designer or integrations with UCC and UIS? I can't think of any because most would show up as compiler errors. I am just not sure if any reflection code might have issues, if there is any.

(Note, the reason for wanting this is to allow my own code to exist in an assembly)

Here are the assembly references I needed to compile. Surface testing appears ok.

1609712825522.png
 
Last edited:
You can move it to an assembly - the assembly definition feature doesn't support dlls with the version that Behavior Designer ships with so that's why I haven't done it.
 
You can move it to an assembly - the assembly definition feature doesn't support dlls with the version that Behavior Designer ships with so that's why I haven't done it.
I hit a problem putting Behavior Designer in an assembly. Unity type variables aren't available. As you can see from the screen shot below. There are placeholders for them with the narrow lines at the bottom of the list.

I have commited to this strategy and it would be a long road back if I had to pull Behavior Designer out of its own assemble.

Because It is a DLL, I can't work out what is missing. Justin could you please help?

Note, I created the behavior tree before putting BD in its assembly and the unity type variables are still working. I just can't edit unity variables in the tree.

I had a peek at the code, I am not sure if it is on the loading of the classes, or on the displaying.

The load runs through looking for type SharedVariable: foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()). But because those lines are appearing on the droplist, I suspect it is an error in the rendering that is causing the issue.


btvar.png

The editor is throwing this error, if this helps.
 
Last edited:
Code:
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <9577ac7a62ef43179789031239ba8798>:0)
BehaviorDesigner.Editor.VariableInspector.LeftMouseDown (BehaviorDesigner.Runtime.IVariableSource variableSource, BehaviorDesigner.Runtime.BehaviorSource behaviorSource, UnityEngine.Vector2 mousePosition, System.Collections.Generic.List`1[T] variablePosition, System.Single variableStartPosition, UnityEngine.Vector2 scrollPosition, System.Int32& selectedVariableIndex, System.String& selectedVariableName, System.Int32& selectedVariableTypeIndex) (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.VariableInspector.LeftMouseDown (BehaviorDesigner.Runtime.IVariableSource variableSource, BehaviorDesigner.Runtime.BehaviorSource behaviorSource, UnityEngine.Vector2 mousePosition) (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.HandleEvents () (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnGUI () (at <59a5905788cf4a0d801f900b29f20efe>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.DockArea.OldOnGUI () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:366)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:676)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:648)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:641)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:607)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:596)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:529)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Events/IEventDispatchingStrategy.cs:113)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Events/MouseEventDispatchingStrategy.cs:35)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Events/MouseEventDispatchingStrategy.cs:26)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Events/MouseEventDispatchingStrategy.cs:19)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:373)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:299)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:264)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:75)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:364)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:216)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Panel.cs:411)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:466)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <a8eb1be68acb4659af00824c7808e2c0>:0)
 
Are you using the runtime source version? The runtime for this is contained within its own assembly.
 
Are you using the runtime source version? The runtime for this is contained within its own assembly.
Sorry, Justin, I am not sure what you mean, I am not very familiar with assemblies. I am using the standard install of Behaviour designer, which uses the compiled DLL's. Is there a source code version I could use instead?

EDIT: I found the Runtime Source download on the downloads page. I will install the source version of the DLL, if that is what it is. Then all of BD will all be in the one assembly and hopefully fix the issue. I will just do a full backup first. When this is done, I will post back. Thx.
 
Last edited:
Are you using the runtime source version? The runtime for this is contained within its own assembly.
Hi Justin,

There seems to be a conflict with class SharedItemDefinition between UIS and UCC BD integrations. Both declare this class, but it results in the below error within the BD editor.

A little more detail....

There is a conflict between SharedItemDefinition in BehaviorDesigner.Runtime.Tasks.UltimateInventorySystem and BehaviorDesigner.Runtime.Tasks.UltimateCharacterController, both classes have their own version with the same name.

This is throwing an error in BehaviorDesigner that is stopping the Unity shared variable types from loading (See error below).

I tried manually renaming this class without propagating the rename, but it breaks the respective system.

I temporarily removed the UIS Behavior Designer integration folder. This resolved the issue and variables are now visible in BD. But of course, UIS integration is now broken. I am not using UIS just yet, but I plan to soon. Do you know how I can have both UCC & UIS integrations loaded at once?

Code:
gumentException: An item with the same key has already been added. Key: SharedItemDefinition
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <9577ac7a62ef43179789031239ba8798>:0)
BehaviorDesigner.Editor.VariableInspector.FindAllSharedVariableTypes (System.Boolean removeShared) (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.VariableInspector.DrawHeader (BehaviorDesigner.Runtime.IVariableSource variableSource, System.Boolean fromGlobalVariablesWindow, System.Single& variableStartPosition, System.String& variableName, System.Boolean& focusNameField, System.Int32& variableTypeIndex, System.Int32& selectedVariableIndex, System.String& selectedVariableName, System.Int32& selectedVariableTypeIndex) (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.VariableInspector.DrawVariables (BehaviorDesigner.Runtime.IVariableSource variableSource, BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.String& variableName, System.Boolean& focusNameField, System.Int32& variableTypeIndex, UnityEngine.Vector2& scrollPosition, System.Collections.Generic.List`1[System.Single]& variablePosition, System.Single& variableStartPosition, System.Int32& selectedVariableIndex, System.String& selectedVariableName, System.Int32& selectedVariableTypeIndex) (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.VariableInspector.DrawVariables (BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.DrawPropertiesBox () (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.Draw () (at <59a5905788cf4a0d801f900b29f20efe>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnGUI () (at <59a5905788cf4a0d801f900b29f20efe>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.DockArea.OldOnGUI () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:366)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:676)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:648)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:641)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:607)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:596)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/IMGUIContainer.cs:529)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Events/EventHandler.cs:125)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Events/MouseCaptureDispatchingStrategy.cs:83)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:373)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:299)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:264)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:75)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:364)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/EventDispatcher.cs:216)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/Panel.cs:411)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:466)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.13/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <a8eb1be68acb4659af00824c7808e2c0>:0)
 
Last edited:
It looks like there was an extra Shared Item Definition within the UCC integration package. I've removed it so you should now only have one SharedItemDefintionBase come in. Unity Packages don't handle deletions though so before you import make sure you delete the UCC integrations folder within Behavior Designer.
 
Top