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.
-
AuthorPosts
-
February 15, 2022 at 12:31 am #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.
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.
February 15, 2022 at 1:02 am #7696Try 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.February 15, 2022 at 1:10 am #7698I 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.
February 15, 2022 at 2:16 pm #7727Hmm. 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)
-
AuthorPosts
You must be logged in to reply to this topic.