Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: "KeyNotFoundException: No action found of type WanderGoal" potential AgentBehaviour bug #83

Closed
kadallah opened this issue Oct 6, 2023 · 5 comments
Labels

Comments

@kadallah
Copy link

kadallah commented Oct 6, 2023

Describe the bug
I'm currently trying to follow along the tutorial, and it seems like I'm getting stuck just at the very end. I was having trouble figuring out how to add/configure the Agent Behaviour component, so I added the one that was imported here: Assets/Imported/CrashKonijn/GOAP/Runtime/CrashKonijn.Goap/Behaviours/AgentBehaviour.cs

Now, when I hit play, I get the following error:

KeyNotFoundException: No action found of type WanderGoal
CrashKonijn.Goap.Classes.GoapSet.ResolveGoal[TGoal] () (at Assets/Imported/CrashKonijn/GOAP/Runtime/CrashKonijn.Goap/Classes/GoapSet.cs:53)
CrashKonijn.Goap.Behaviours.AgentBehaviour.SetGoal[TGoal] (System.Boolean endAction) (at Assets/Imported/CrashKonijn/GOAP/Runtime/CrashKonijn.Goap/Behaviours/AgentBehaviour.cs:181)
AgentBrain.Start () (at Assets/Scripts/AgentBrain.cs:15)

I believe that I configured everything else correctly, but please let me know if there is anything I should check specifically.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Import asset from Unity through the Package Manager.
  2. Follow the tutorial.
  3. Add the imported AgentBehaviour component to agent.
  4. Press play.

Expected behavior
The agent should wander without any specific goal.

Unity Version
2022.3.9f1

Unity.Collections Version
Please mention the Unity.Collections version you are using.

Package Version
Please mention the package version you are using.

Additional context
It might be worth it to mention that I'm using this in a 3D project, so the Agent GameObject also has a NavMeshAgent. I've tried running with it both on and off.

Thank you for your hard work! This documentation has been amazing thus far (even if I haven't quite gotten this to work yet).

@kadallah kadallah added the bug label Oct 6, 2023
@crashkonijn
Copy link
Owner

Hi there @kadallah!

Thanks for your detailed report, that helps a lot!

The error means that no WanderGoal has been added to the GoapSet configuration.

Are you using the setup through ScriptableObjects or code?

If you're using the SO's, it should be set up like this, shown in step 9:
image

If you're using code it should be step 5
image

Please let me know if this fixes your issues, or if you're still running into trouble!

Ps. If you run into more issues you could join our Discord, I can help you quicker there 😄

@kadallah
Copy link
Author

kadallah commented Oct 7, 2023

Hi, thanks for the speedy reply. I'm using SO and I think I have this configured correctly:
Screenshot 2023-10-07 143115.

I just joined the Discord. I may ask for some more help over there during the week, but for now I'll stick here in case someone else runs into the issue and finds the troubleshooting helpful. Unless you'd prefer to triage over there.

@crashkonijn
Copy link
Owner

Hi again!

That does seem like you've set it up correctly!

Is there any chance you have a WanderGoal from the demo, and your own from the tutorial in the project?

I think you might have added one in your setup and are calling SetGoal with the other one. At least that would explain this.

@kadallah
Copy link
Author

kadallah commented Oct 9, 2023

Screenshot 2023-10-09 125308

This is the WanderGoal that's attached to my GettingStartedSet. As you can see, this is the one that I've created, not the one that was imported. Is there anywhere else that I should check?

@crashkonijn
Copy link
Owner

We resolved this on Discord.

It was indeed a mixup between different classes in the config and the actual class being used in the agent brain.

Thanks again for all your info and your descriptive bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants