Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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