2.1.4 Issues

Thanks, I was able to reproduce this. I'll take a look and send you a new version as soon as I fix it.
 
Ended up with the sub tree loaded on design time after exiting play mode.

Can't really say what happened and how to repro as its happening really rare and randomly (2 times in 4 days).
Unity_7tMOkitLhS.png
My graph looked like this:
1759913651017.png

If it helps, I am playing around with this logic to test some features:

public class EquipWeaponSubTree : MonoBehaviour
{
public BehaviorTree tree;
public Subtree ref1;
public Subtree ref2;

private Subtree instance1;
private Subtree instance2;


private void Start()
{
instance1 = Instantiate(ref1);
instance2 = Instantiate(ref2);

instance1.Deserialize();
instance2.Deserialize();

instance1.Pooled = true;
instance2.Pooled = true;
}

public void Equip1()
{
bool result = tree.SetVariableValue("EquippedWeapon", instance1, Opsive.GraphDesigner.Runtime.Variables.SharedVariable.SharingScope.GameObject);

Debug.LogWarning($"Equip1 set variable result: {result}");

tree.ReevaluateSubtreeReferences();
}

public void Equip2()
{
bool result = tree.SetVariableValue("EquippedWeapon", instance2, Opsive.GraphDesigner.Runtime.Variables.SharedVariable.SharingScope.GameObject);
Debug.LogWarning($"Equip2 set variable result: {result}");

tree.ReevaluateSubtreeReferences();
}


private void OnGUI()
{
GUILayout.Label("Equip Weapon Subtree Example");
if (GUILayout.Button("Equip Weapon 1"))
{
Equip1();
}

if (GUILayout.Button("Equip Weapon 2"))
{
Equip2();
}
}
}
 
NullReferenceException: Object reference not set to an instance of an object
Opsive.GraphDesigner.Editor.Controls.SharedVariableOverridesListAttributeControl+SharedVariableOverrideElement.OnGraphSerialized (Opsive.GraphDesigner.Runtime.IGraph graph) (at <e84523ae354943d7b07652a1961700bc>:0)
Opsive.GraphDesigner.Editor.Events.GraphEventHandler.Invoke[T1] (Opsive.GraphDesigner.Editor.Events.GraphEventType eventType, T1 arg1) (at <e84523ae354943d7b07652a1961700bc>:0)
Opsive.GraphDesigner.Editor.GraphWindow.SerializeGraph (System.Boolean force, System.Boolean updateNodeProperties) (at <e84523ae354943d7b07652a1961700bc>:0)
Opsive.GraphDesigner.Editor.Manipulators.ContentDragger.OnMouseUp (UnityEngine.UIElements.MouseUpEvent e) (at <e84523ae354943d7b07652a1961700bc>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToElementUnderPointerOrPanelRoot (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.PointerUpEvent.Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <58affde3b6cc47f39fa7e8b94d5890c0>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <9fed903c750c40ad88e137acb27455b3>:0)
 
Since updating to 2.1.4 I get null references when editing the graph:

NullReferenceException: Object reference not set to an instance of an object
Opsive.GraphDesigner.Editor.Views.GraphView.RemoveFromSelection (Opsive.GraphDesigner.Editor.ISelectable selectable) (at &lt;e84523ae354943d7b07652a1961700bc&gt;:0)
Opsive.GraphDesigner.Editor.Views.GraphView.ClearSelection () (at &lt;e84523ae354943d7b07652a1961700bc&gt;:0)
Opsive.GraphDesigner.Editor.Views.GraphView.OnMouseDown (UnityEngine.UIElements.MouseDownEvent evt) (at &lt;e84523ae354943d7b07652a1961700bc&gt;:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToElementUnderPointerOrPanelRoot (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.PointerDownEvent.Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean&amp; eventHandled) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.UIElements.UIEventRegistration+&lt;&gt;c.&lt;.cctor&gt;b__1_2 (System.Int32 i, System.IntPtr ptr) (at &lt;58affde3b6cc47f39fa7e8b94d5890c0&gt;:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean&amp; result) (at &lt;9fed903c750c40ad88e137acb27455b3&gt;:0)
 
This relates to the remove issue you posted about before. The list is cached to improve performance and that's causing a problem. I have it fixed in 2.1.5.
 
A few versions ago this used to occur extremely often. It relates to the tree being serialized when the subtree is synced and unity just stopping play mode .I really thought that it was solved though.. Please let me know if you can repro it.
 
Back
Top