- A* version: 5.3.7
- Unity version: 2022.3.45f1
Hello. I started using this package not long ago. It’s great, and I’ve had no issues until now. I’ve been using custom off-mesh links, with no problems, but I recently added a new custom off-mesh link script, and when the agent reaches the link, Unity crashes instantly, and I get a StackOverflowException in the logs.
StackOverflowException: The requested operation caused a stack overflow.
at Unity.Properties.PropertyVisitor.Unity.Properties.IPropertyBagVisitor.Visit[TContainer] (Unity.Properties.IPropertyBag`1[TContainer] properties, TContainer& container) <0x19ad2073700 + 0x00048> in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyBag`1[TContainer].Unity.Properties.IPropertyBag<TContainer>.Accept (Unity.Properties.IPropertyBagVisitor visitor, TContainer& container) [0x00001] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyBag.AcceptWithSpecializedVisitor[TContainer] (Unity.Properties.IPropertyBag`1[TContainer] properties, Unity.Properties.IPropertyBagVisitor visitor, TContainer& container) [0x000b4] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyContainer.TryAccept[TContainer] (Unity.Properties.IPropertyBagVisitor visitor, TContainer& container, Unity.Properties.VisitReturnCode& returnCode, Unity.Properties.VisitParameters parameters) [0x00103] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyContainer.TryAccept[TContainer] (Unity.Properties.IPropertyBagVisitor visitor, TContainer& container, Unity.Properties.VisitParameters parameters) [0x00001] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyVisitor.VisitProperty[TContainer,TValue] (Unity.Properties.Property`2[TContainer,TValue] property, TContainer& container, TValue& value) [0x00001] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyVisitor.ContinueVisitation[TContainer,TValue] (Unity.Properties.Property`2[TContainer,TValue] property, TContainer& container, TValue& value) [0x00086] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyVisitor.ContinueVisitationWithoutAdapters[TContainer,TValue] (Unity.Properties.Property`2[TContainer,TValue] property, Unity.Properties.Internal.ReadOnlyAdapterCollection+Enumerator enumerator, TContainer& container, TValue& value) [0x00001] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyVisitor.ContinueVisitation[TContainer,TValue] (Unity.Properties.Property`2[TContainer,TValue] property, Unity.Properties.Internal.ReadOnlyAdapterCollection+Enumerator enumerator, TContainer& container, TValue& value) [0x0011a] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.PropertyVisitor.Unity.Properties.IPropertyVisitor.Visit[TContainer,TValue] (Unity.Properties.Property`2[TContainer,TValue] property, TContainer& container) [0x00051] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
at Unity.Properties.Property`2[TContainer,TValue].Accept (Unity.Properties.IPropertyVisitor visitor, TContainer& container) [0x00000] in <c6cf1933b94a4407b76866cfe9f46dc2>:0
This goes on for a while...
I’m implementing IOffMeshLinkHandler and IOffMeshLinkStateMachine with a FollowerEntity, not a NodeLink2. It works completely fine with one of my custom scripts, but crashes with the other.
Code for the working script:
IOffMeshLinkStateMachine IOffMeshLinkHandler.GetOffMeshLinkStateMachine(AgentOffMeshLinkTraversalContext context)
{
Debug.Log(context.link.link.gameObject.name);
context.transform.Position = context.link.link.component.transform.position;
context.transform.Rotation = context.link.link.component.transform.rotation;
PlayAnim(context.link.link.gameObject.GetComponent<OffMeshLink_Component>().TraverseType);
return this;
}
IEnumerable IOffMeshLinkStateMachine.OnTraverseOffMeshLink(Pathfinding.ECS.AgentOffMeshLinkTraversalContext context)
{
yield return new WaitForEndOfFrame();
float t = animator.GetCurrentAnimatorStateInfo(0).length;
float elapsed = 0;
while (elapsed < t)
{
elapsed += Time.deltaTime;
yield return null;
}
yield return null;
}
void IOffMeshLinkStateMachine.OnFinishTraversingOffMeshLink(Pathfinding.ECS.AgentOffMeshLinkTraversalContext context)
{
context.transform.Position = context.link.link.component.GetComponent<NodeLink2>().end.position;
animator.CrossFade("Run", 0, 0, 0);
}
Code for the one that crashes:
IOffMeshLinkStateMachine IOffMeshLinkHandler.GetOffMeshLinkStateMachine(AgentOffMeshLinkTraversalContext context)
{
return this;
}
IEnumerable IOffMeshLinkStateMachine.OnTraverseOffMeshLink(Pathfinding.ECS.AgentOffMeshLinkTraversalContext context)
{
yield return null;
}
void IOffMeshLinkStateMachine.OnFinishTraversingOffMeshLink(Pathfinding.ECS.AgentOffMeshLinkTraversalContext context)
{
}
I know it’s empty, but posted it anyway for clarity’s sake.
Even when I put a Debug.Log where it begins, I get nothing in the crash logs.