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
  • #7693


    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.
    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.Minds.BasicMind:SetBehavior(BTAsset, List`1)

    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 ()


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


    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.



    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.


    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.