Forum rules - please read before posting.

Headtarget crash bug

I noticed i got a fatal crash in the latest AC (1.71.2) when returning to a scene where the player was previously looking at something.

StackOverflowException: The requested operation caused a stack overflow.
UnityEngine.Object.IsNativeObjectAlive (UnityEngine.Object o) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:161)
UnityEngine.Object.CompareBaseObjects (UnityEngine.Object lhs, UnityEngine.Object rhs) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:140)
UnityEngine.Object.op_Equality (UnityEngine.Object x, UnityEngine.Object y) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:403)
AC.Player.IsActivePlayer () (at Assets/AdventureCreator/Scripts/Character/Player.cs:724)
AC.Player.SetHeadTurnTarget (UnityEngine.Transform _headTurnTarget, UnityEngine.Vector3 _headTurnTargetOffset, System.Boolean isInstant, AC.HeadFacing _headFacing) (at Assets/AdventureCreator/Scripts/Character/Player.cs:473)

In a scene, the player was facing (with head) another character. When leaving the scene and then returning, the crash occured. If I add a Stop looking action before leaving the scene, there is no error. This did not happen in 1.70.

I am using Local players in my scenes, as it's easier for me to adjust character parameters when the player is in the scene. I get a console message/warning about Local player found, perhaps there's been some changes to the player code that could affect this?

AC 1.71.2/Unity 2018.4.18/Windows 10

Comments

  • Thanks for the details, I'll attempt a recreation. Is that the whole message, and what is your character's animation engine?

  • edited May 21

    I use mecanim animations with Head-turning IK. There might have been a few more lines that repeated after the last, sorry for not including them. I can probably force this error again if you need more info.

    EDIT: Here's the last line, repeated around 20 times:
    AC.Player.SetHeadTurnTarget (UnityEngine.Transform _headTurnTarget, UnityEngine.Vector3 _headTurnTargetOffset, System.Boolean isInstant, AC.HeadFacing _headFacing) (at Assets/AdventureCreator/Scripts/Character/Player.cs:475)

  • Open up Player.cs, and find the following around line 473:

    if (!IsActivePlayer ())
    {
        SetHeadTurnTarget (_headTurnTarget, _headTurnTargetOffset, isInstant, _headFacing);
        return;
    }
    

    Change it to:

    if (!IsActivePlayer ())
    {
        base.SetHeadTurnTarget (_headTurnTarget, _headTurnTargetOffset, isInstant, _headFacing);
        return;
    }
    
  • Excellent, Chris! No more crashing with the updated script!

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.
Do NOT follow this link or you will be banned from the site!