News Forums RAIN General Discussion and Troubleshooting Behavior Tree Exception

This topic contains 3 replies, has 2 voices, and was last updated by  prime 1 year, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7693

    Neji107
    Participant

    I am not sure if this error was caused by the 2.10 update, but I first saw it after I upgraded.

    I have a basic object (a cube) set up with a “Wander” Behavior Tree, basically the same one from the tutorial (it uses the “AIChooseWanderLocation” custom action). The object has been successfully wandering. Then I upgraded to v2.10. After that I tried to create another object and assign it the exact same Behavior Tree, but when I ran the scene I got exceptions. Even when I copy+pasted the exact same cube object I still got the same exception. Only the original cube object would successfully wander.

    I would see these errors in order on the Unity console:

    The referenced script on this Behavior is missing!

    Failed to Failed to load Behavior Tree: Exception has been thrown by the target of an invocation.
    UnityEngine.Debug:LogWarning(Object)
    RAIN.BehaviorTrees.BTLoader:LoadNode(ObjectElement, List`1, Assembly)
    RAIN.BehaviorTrees.BTLoader:LoadNode(ObjectElement, List`1, Assembly)
    RAIN.BehaviorTrees.BTLoader:Load(BTAsset, List`1, String, Assembly)
    RAIN.BehaviorTrees.Behavior:Load()
    RAIN.BehaviorTrees.Behavior:get_BehaviorRoot()
    RAIN.Minds.BasicMind:SetBehavior(BTAsset, List`1)
    RAIN.Minds.BasicMind:AIInit()
    RAIN.Core.RAINAIElement:AIInit(AI)
    RAIN.Core.AI:AIInit()
    RAIN.Core.AIRig:AIAwake()
    RAIN.Core.AIRig:Awake()

    NullReferenceException: Object reference not set to an instance of an object.
    RAIN.BehaviorTrees.BTSequencerNode.Execute (RAIN.Core.AI ai)
    RAIN.BehaviorTrees.BTNode.Run (RAIN.Core.AI ai)
    RAIN.Minds.BasicMind.Think ()
    RAIN.Core.AI.Think ()
    RAIN.Core.AIRig.AIUpdate ()
    RAIN.Core.AIRig.Update ()

    Thanks.

    • This topic was modified 1 year, 4 months ago by  Neji107.
    #7696

    prime
    Keymaster

    Try this:

    Go through your custom actions in your BT and
    1) change the action so that it is set to a different custom action than the one you want
    2) change it back to the correct one.

    #7698

    Neji107
    Participant

    I think I found the culprit, in the custom action script:
    public float terrainY = Terrain.activeTerrain.GetPosition().y;

    Was this deprecated in the update? How can I make sure my terrain is the ‘activeTerrain’?

    • This reply was modified 1 year, 4 months ago by  Neji107.
    #7727

    prime
    Keymaster

    Hmm. Terrain is a Unity thing of course, not a RAIN thing. Should be set automatically.

    You haven’t created your own class called Terrain have you? (that can cause problems)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.