News › Forums › RAIN › General Discussion and Troubleshooting › Unable to load custom actions when setting new behavior tree to a mind
This topic contains 8 replies, has 5 voices, and was last updated by chirpytime 9 months ago.
-
AuthorPosts
-
November 13, 2022 at 1:58 pm #5249
Hi, I’m having an issue using Custom RAINActions. Whenever I try to set a new behavior tree to the Agent’s Mind, I get warnings and exceptions. Here’s the detailed info:
The code I’m running is
mind.SetBehavior(btAsset, new List<BTAssetBinding>());where mind is a BasicMind, btAsset is a reference to the Asset of the behavior tree I want to switch to.
Whenever this code runs, I get the following:Error on RAIN.Action.LoadActionInstance(String, String, Assembly):
Unable to load custom action: CustomActionNameWarning on RAIN.BehaviorTrees.BTLoader:LoadNode(ObjectElement, List`1, Assembly):
Failed to load Behavior Tree:
Object reference not set to an instance of an objectMy custom actions have the [RAINAction] attribute and they appear on the behavior tree editor, so I can’t understand what is wrong in the actions. The custom actions that appear in the errors are the ones that the new behavior tree contains in its nodes.
-
This topic was modified 1 year, 7 months ago by
Fox.
November 13, 2022 at 2:50 pm #5254@Fox,
I had some similar problems in my project after updating from RAIN{indie} to RAIN 2.0.5.
-
For some reason, I had a problem in my code that didn’t cause a compilation error, but it did cause the “Custom Action” to fail to load, similar to how you mentioned above.
-
I think I posted about it here:
-
http://rivaltheory.com/forums/topic/upgrade-paths-rain-beta-to-rain-2-0/
-
Maybe you are seeing something similar and the code change I made will help you?-
This reply was modified 1 year, 7 months ago by
Aaron Mueller.
November 14, 2022 at 12:30 pm #5300Thanks for the reply! I actually saw your post before, but somehow missed part of the solution. I solved this by starting a Coroutine where I put the major part of the code that was inside the custom action. This code was making modifications to the AI / Behavior Tree.
However, it only solved some of the errors. There are still custom actions that fail to load when I call BasicMind.AIInit() after changing the behaviour tree. I’ve changed some of the custom actions to a single line of code
return ActionResult.SUCCESS;
and they still fail to load.
November 14, 2022 at 9:35 pm #5316We can take a look if you have a project you can share.
November 15, 2022 at 5:15 pm #5342The “unable to load custom action” error was solved by removing the “using project.namespace;” instructions and replacing it with the classes with the full namespace path each time they were used, like this: project.namespace.Class ohHaiThere;
Will you be able to fix this problem in a future patch? Or do we have to be careful from now on when using multiple namespaces?
November 19, 2022 at 12:06 pm #5428I’m working with Fox, and after some tests, it appears the problem isn’t solved solely from clearing usings.
There is a custom RAINAction that is being loaded and is working in one behaviour tree, but triggers an “Unable to load custom action: (..)” in another tree when trying to load it during runtime.
They are both being loaded at runtime.
Any idea what might trigger this error?
How can I know more about it?
Unable to load custom action: xx isn’t very helpful.November 20, 2022 at 2:00 am #5479I don’t know why one attempt would succeed and another would fail. Loading a custom action involves scanning the loaded assemblies to try to find a match. Only classes that have the [RAINAction] attribute are considered.
It is possible that the behavior tree could get out of sync, for instance if you are using namespaces and they change. To resolve it, you might need to find the custom action that is failing, set it to a different custom action, wait for the BT to save itself, and then set it back to the correct action again.
If that doesn’t work, then I’m going to need to find a way to reproduce the problem so we can track it down.
November 21, 2022 at 12:34 pm #5561Resetting the custom action did the trick.
Thank you prime.October 10, 2022 at 5:20 am #33410Thanks! I was playing with RAIN 2.1.3 QuickStart project and had the same issue. I had auto-compile off, created a custom action from the behavior editor, and then back to editor, manual refresh. No compilation error, but assembly error.
-
This topic was modified 1 year, 7 months ago by
-
AuthorPosts
You must be logged in to reply to this topic.