Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game The Unity Editor and Scene Setup Importing Assets

There is an error.

I downloaded the package and I imported it into unity and it worked until the import finished then it said "Assets/Standard Assets/Characters/ThirdPersonCharacter/Scripts/AICharacterControl.cs(10,16): error CS0246: The type or namespace name NavMeshAgent' could not be found. Are you missingUnityEngine.AI' using directive? " I don't know what to do.

Tagging Nick Pettit

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I did some research and found this thread talking about this specific eror in Unity. It seems the solution might be adding this to the top of your file:

using UnityEngine.AI;

Apparently some objects and methods have been moved around inside the namespace. Try this and see if it helps. Otherwise, you're likely going to have to wait for an answer from Nick.

Hope this helps! :sparkles:

Nick Pettit
Nick Pettit
Treehouse Teacher

This is correct, thanks Jennifer!

I'm currently working on a small refresh of this course to fix some issues that have appeared since the course was released. As Unity gets updated, so must the courses! Thanks for being patient everyone. :)

Hello Jennifer. Thank you for posting that. I am new to this and so, I don't even know how to add what you suggested to the top of the file. What do you mean exactly? I am sorry!

K Cleveland
K Cleveland
21,839 Points

Going off of what Jennifer wrote: "Are you missing UnityEngine.AI' using directive?" is where you should focus your attention. It seems likely that in this case, because you didn't include "using UnityEngine.AI;" you are unable to refer to NavMeshAgent.

It's really helpful to be able to recognize this type of error, because it is incredibly common and you will see versions of this error across multiple languages, not just in the Unity Editor(and C#).

https://docs.unity3d.com/Manual/Namespaces.html