2.1 Object DisposedException

CosmicArbiter

New member
After Updating, spawning an Agent with even just an Idle in the tree results in an error:


C#:
ObjectDisposedException: Cannot access a disposed object.
Object name: 'The NativeArray has been disposed, it is not allowed to access it'.
Unity.Entities.WorldUnmanaged.GetImpl () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/WorldUnmanaged.cs:1056)
Unity.Entities.WorldUnmanaged.get_EntityManager () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/WorldUnmanaged.cs:935)
Unity.Entities.World.get_EntityManager () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/World.cs:174)
Opsive.BehaviorDesigner.Editor.Controls.NodeViews.TaskNodeViewControl.OnSelectionChange (UnityEngine.Object selection) (at ./Packages/com.opsive.behaviordesigner/Editor/NodeViews/TaskNodeViewControl.cs:263)
Opsive.BehaviorDesigner.Editor.Controls.NodeViews.TaskNodeViewControl.AddNodeView (Opsive.GraphDesigner.Editor.GraphWindow graphWindow, UnityEngine.UIElements.VisualElement parent, System.Object node) (at ./Packages/com.opsive.behaviordesigner/Editor/NodeViews/TaskNodeViewControl.cs:120)
Opsive.GraphDesigner.Editor.Elements.EditorNode.UpdateNodeView () (at <8d87e4351763443eabb8b752c01b2b96>:0)
Opsive.GraphDesigner.Editor.Elements.LogicNode..ctor (Opsive.GraphDesigner.Editor.GraphWindow graphWindow, Opsive.GraphDesigner.Runtime.ILogicNode node, Opsive.GraphDesigner.Runtime.NodeProperties nodeProperties, System.Boolean newPosition) (at <8d87e4351763443eabb8b752c01b2b96>:0)
Opsive.GraphDesigner.Editor.Views.GraphView.CreateEditorLogicNode (Opsive.GraphDesigner.Runtime.ILogicNode node, Opsive.GraphDesigner.Runtime.LogicNodeProperties nodeProperties, System.Boolean addNodeProperties, System.Boolean newPosition) (at <8d87e4351763443eabb8b752c01b2b96>:0)
Opsive.GraphDesigner.Editor.Views.GraphView.LoadGraph () (at <8d87e4351763443eabb8b752c01b2b96>:0)
Opsive.GraphDesigner.Editor.GraphWindow.LoadGraph (Opsive.GraphDesigner.Runtime.IGraph graph, System.Boolean force, System.Boolean updateActive) (at <8d87e4351763443eabb8b752c01b2b96>:0)
Opsive.BehaviorDesigner.Editor.Inspectors.BehaviorTreeInspector.ShowHeaderElements (UnityEngine.UIElements.VisualElement container) (at <0ea79ec9ff634f66b5004d072f72140e>:0)
Opsive.Shared.Editor.UIElements.UIElementsInspector.DrawElements (UnityEngine.UIElements.VisualElement container, System.Boolean nested) (at <15e63cfd5cff4b53a19097e39928e2a7>:0)
Opsive.Shared.Editor.UIElements.UIElementsInspector.CreateInspectorGUI () (at <15e63cfd5cff4b53a19097e39928e2a7>:0)
UnityEditor.UIElements.InspectorElement.CreateInspectorElementUsingUIToolkit (UnityEditor.Editor targetEditor) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.UIElements.InspectorElement.CreateInspectorElementFromSerializedObject (UnityEditor.SerializedObject bindObject) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.UIElements.InspectorElement.HandleEventBubbleUp (UnityEngine.UIElements.EventBase evt) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAtTargetAndDefaultPhase (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at <afa60f2da52c45bd9a002fa6beffa36b>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.SendBindingEvent[TEventType] (TEventType evt, UnityEngine.UIElements.VisualElement target) (at <0bf6a92aeba0453e84370d92494918d5>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <0bf6a92aeba0453e84370d92494918d5>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <0bf6a92aeba0453e84370d92494918d5>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.Bind (UnityEngine.UIElements.VisualElement element) (at <0bf6a92aeba0453e84370d92494918d5>:0)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation.Bind (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedObject obj) (at <0bf6a92aeba0453e84370d92494918d5>:0)
UnityEditor.UIElements.BindingExtensions.Bind (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedObject obj) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.UIElements.InspectorElement.SetEditor (UnityEditor.Editor value) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.UIElements.EditorElement.Reinit (System.Int32 editorIndex, UnityEditor.Editor[] editors) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.PropertyEditor.ProcessEditorElementsToRebuild (UnityEditor.Editor[] editors) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.PropertyEditor.RebuildContentsContainers () (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
UnityEditor.InspectorWindow.RedrawFromNative () (at <f027a8df36c54c51b6e201bed8ecb82d>:0)
 
How are you spawning the agent? Can you send me a repro scene?
False Alarm there, restarted editor, have not seen it since.

I am getting some rather strange results with tasks though. I ported over all my custom tasks to the new system, but not fully working.

Somehow one of my conditionals is returning a status of Running, which I was not aware was possible, as its just a simple bool check, and setting it to either success or failure.

EDIT:
After some more testing, my current theory is that after being Reevaluated, the task is being set to Running, instead of queued, and since the current template for conditionals just check taskComponent.Status == TaskStatus.Queued They are not actually doing anything, and just getting stuck.

Setting it to taskComponent.Status == TaskStatus.Queued || taskComponent.Status == TaskStatus.Running Seems to have fixed my issues for now. Unless im missing something, it looks like either the template for conditionals needs to be changed, or reevaluated tasks need to be set to queued instead of Running.
 
Last edited:
Also, unrelated, but if I have Nodes in a group, I can no longer select the connections (the White lines connecting nodes). It just selects the group background.
 
False Alarm there, restarted editor, have not seen it since.

I am getting some rather strange results with tasks though. I ported over all my custom tasks to the new system, but not fully working.

Somehow one of my conditionals is returning a status of Running, which I was not aware was possible, as its just a simple bool check, and setting it to either success or failure.

EDIT:
After some more testing, my current theory is that after being Reevaluated, the task is being set to Running, instead of queued, and since the current template for conditionals just check taskComponent.Status == TaskStatus.Queued They are not actually doing anything, and just getting stuck.

Setting it to taskComponent.Status == TaskStatus.Queued || taskComponent.Status == TaskStatus.Running Seems to have fixed my issues for now. Unless im missing something, it looks like either the template for conditionals needs to be changed, or reevaluated tasks need to be set to queued instead of Running.
Your theory is correct, I remade the entity video and explained why at this time:

Also, unrelated, but if I have Nodes in a group, I can no longer select the connections (the White lines connecting nodes). It just selects the group background.
Good catch, I'll fix that in the next update.
 
Your theory is correct, I remade the entity video and explained why at this time:
That makes sense, as it can save having to redo the logic twice for reevals.
I still think in the default template, it should probably just be taskComponent.Status == TaskStatus.Queued || taskComponent.Status == TaskStatus.Running And let people who want to optimize it by having different logic for running/queued do that.
As right now, the template just doesnt work unless you make your own Running check, which seems worse than having it be a bit less optimized unless you add your own Running check.
 
How are you spawning the agent? Can you send me a repro scene?
I have started getting this Error again, I can reproduce it pretty easily in my scenes. It seems to be happening since 2.1, if I have a behavior designer window open, with one of my Trees visible, without even spawning anything, when running my scene.


Unsure if its due to one of my custom nodes possibly causing the error? Unsure why it would, with nothing being spawned.

Also, I just noticed when I have the behavior design window focused, while the game is running, i get spammed with warning message that say :

C#:
Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle,long,int) (at ./Library/PackageCache/com.unity.collections@d49facba0036/Unity.Collections/Memory.cs:89)
Unity.Collections.Memory/Unmanaged/Array:Resize<Unity.Entities.EntityCommandBufferChain> (Unity.Entities.EntityCommandBufferChain*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle) (at ./Library/PackageCache/com.unity.collections@d49facba0036/Unity.Collections/Memory.cs:96)
Unity.Collections.Memory/Unmanaged:Free<Unity.Entities.EntityCommandBufferChain> (Unity.Entities.EntityCommandBufferChain*,Unity.Collections.AllocatorManager/AllocatorHandle) (at ./Library/PackageCache/com.unity.collections@d49facba0036/Unity.Collections/Memory.cs:41)
Unity.Entities.EntityCommandBufferData:DestroyForParallelWriter () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/EntityCommandBuffer.cs:561)
Unity.Entities.EntityCommandBuffer/Unity.Entities.DisposeInternal_00000408$BurstDirectCall:Invoke (Unity.Entities.EntityCommandBuffer&)
Unity.Entities.EntityCommandBuffer:DisposeInternal (Unity.Entities.EntityCommandBuffer&)
Unity.Entities.EntityCommandBuffer:Dispose () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/EntityCommandBuffer.cs:1978)
Opsive.BehaviorDesigner.Runtime.Tasks.Composites.ParallelTaskSystem:OnUpdate (Unity.Entities.SystemState&) (at ./Packages/com.opsive.behaviordesigner/Runtime/Tasks/Composites/Parallel.cs:103)
Opsive.BehaviorDesigner.Runtime.Tasks.Composites.ParallelTaskSystem/Opsive.BehaviorDesigner.Runtime.Tasks.Composites.__codegen__OnUpdate_00000508$BurstDirectCall:Invoke (intptr,intptr)
Opsive.BehaviorDesigner.Runtime.Tasks.Composites.ParallelTaskSystem:__codegen__OnUpdate (intptr,intptr)
Unity.Entities.SystemBaseRegistry:ForwardToManaged (intptr,Unity.Entities.SystemState*,void*) (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBaseRegistry.cs:364)
Unity.Entities.SystemBaseRegistry:CallForwardingFunction (Unity.Entities.SystemState*,Unity.Entities.UnmanagedSystemFunctionType) (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBaseRegistry.cs:333)
Unity.Entities.SystemBaseRegistry:CallOnUpdate (Unity.Entities.SystemState*) (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBaseRegistry.cs:376)
Unity.Entities.WorldUnmanagedImpl/Unity.Entities.UnmanagedUpdate_0000167C$BurstDirectCall:Invoke (void*)
Unity.Entities.WorldUnmanagedImpl:UnmanagedUpdate (void*)
Unity.Entities.WorldUnmanagedImpl:UpdateSystem (Unity.Entities.SystemHandle) (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/WorldUnmanaged.cs:891)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:717)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:681)
Opsive.BehaviorDesigner.Runtime.Groups.TraversalTaskSystemGroup:OnUpdate () (at ./Packages/com.opsive.behaviordesigner/Runtime/Groups/TaskSystemGroup.cs:33)
Unity.Entities.SystemBase:Update () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBase.cs:418)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:723)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:681)
Opsive.BehaviorDesigner.Runtime.Groups.TraversalSystemGroup:OnUpdate () (at ./Packages/com.opsive.behaviordesigner/Runtime/Groups/TraversalSystemGroup.cs:43)
Unity.Entities.SystemBase:Update () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBase.cs:418)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:723)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:681)
Opsive.BehaviorDesigner.Runtime.Groups.BehaviorTreeSystemGroup:OnUpdate () (at ./Packages/com.opsive.behaviordesigner/Runtime/Groups/BehaviorTreeSystemGroup.cs:59)
Unity.Entities.SystemBase:Update () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBase.cs:418)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:723)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ComponentSystemGroup.cs:687)
Unity.Entities.SystemBase:Update () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/SystemBase.cs:418)
Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/ScriptBehaviourUpdateOrder.cs:523)
 
Back
Top