Forum rules - please read before posting.

Error during AC.ActionCharPathFind.Skip()

Hello! I'm getting an error message if I skip while a character is moving. Skipping during dialogue works perfectly, it's only if they're physially moving from A to B I get this error if I skip:

IndexOutOfRangeException: Index was outside the bounds of the array.
AC.ActionCharPathFind.Skip () (at Assets/AdventureCreator/Scripts/Actions/ActionCharPathFind.cs:314)
AC.ActionList+d__46.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:453)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <61f56803c0b0466195d97f1cb7494aa1>:0)

Direct Control, Independent turning mode, Astar pathfinding. Any ideas? I don't think I'm doing anything out of the ordinary just a Character->MoveToPoint node, moving to a marker. Confirmed it happens on multiple instances of that node.

Comments

  • I can't recreate the issue, but open up AcionCharPathFind and replace line 312:

    else
    

    with:

    else if (i == 0)
    

    Does that resolve it?

  • Yep! Perfect, thank you!

  • Hmm, worked perfectly for a bit, but I can still trigger it occasionally with this error:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    AC.ActionCharPathFind.Skip () (at Assets/AdventureCreator/Scripts/Actions/ActionCharPathFind.cs:317)
    AC.ActionList+d__46.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:453)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <61f56803c0b0466195d97f1cb7494aa1>:0)

    Any thoughts?

  • Looks like a wider issue with the scene, where it's not able to successfully create a destination position for the Action.

    I can add a bypass/warning in this event, but it won't solve the original issue.

    Does the Action have Pathfind? checked, and are both the character and Marker on the NavMesh at the time?

    If so, if you can PM me a .unitypackage of the scene, your Managers, and prefab of the character being affected, I'll see if I can spot what's wrong.

  • Pathfind is checked. Markers are on the navmesh, but characters are held offscreen until they enter... is that the cause of the problem, then?

    What's the best workflow for keeping NPCs offscreen until they're needed?

  • edited March 14

    The workflow's correct. Try replacing line 317 of the same file:

    runtimeChar.Teleport (pointArray[i]);
    

    with:

    if (i >= 0 && i < pointArray.Length) runtimeChar.Teleport (pointArray[i]); else runtimeChar.Teleport (targetPosition);
    
  • That seems to have done it, thanks! I'll run some more tests and get back to you if any more instances crop up!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.