- Home /
[FIXED] 2D Platformer – The name Seeker does not exist in current context
Hi All,
Firstly thank you for taking the time to look at my question.
I'm new to making games and Unity and I'm currently working my way through a 2D platformer tutorial and I've hit a snag I can't solve.
When I try to create a new Seeker object from the Astrostar I'm getting the following error:
Here is my code:
using UnityEngine;
using Pathfinding;
[RequireComponent (typeof(Rigidbody2D))]
[RequireComponent (typeof (Seeker))]
public class EnemyAI : MonoBehaviour {
public Transform target;
public float updateRate = 2; //times per second
private Seeker seeker;
private Rigidbody2D rb;
//The calculated path
public Path path;
//The AI's speed per second
public float speed = 300f;
}
I'm not sure whether it's related but I have another few error messages that have popped up today that weren't there when I was working yesterday. I cannot work out for the life of me what I did to incur these. Despite these messages the game still works as it did yesterday.
Thanks in advance for any advice you can offer!
"Seeker" probably doesn't exist in the Pathfinding class... If you are watching a tutorial it is probably updated class. I would either do pathfinding yourself or type Pathfinding.
and looking at your options. Chances are the developer renamed it or un-capitalized it.
I did think that but I found the Seeker class. I can actually add it as a component to my GameObject. I'm confused as to why I can add it to my GameObject but not use it as a type for a variable in my own script on the same GameObject.
Answer by hexagonius · Mar 18, 2017 at 11:15 AM
looks to me is if mono or vs, whatever you're using, is out of sync with the project. otherwise unity would show the same error. in unity go you Edit -> Open C# Project. if that does not help you could also delete the IDE related files from your unity project folder while it's closed and open it again
At that fixed it THAN$$anonymous$$ YOU @hexagonius that was frustrating me! I am completely new to unity and C# and I thought I had made a nooby syntax error or something! Opening the full C# project has completely fixed this.
Your answer
Follow this Question
Related Questions
myObjetc..GetType().GetCustomAttributes(typeof(RequireComponent) not working correctly 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
A* Pathfinding on click? 0 Answers
Adding a delay for weapon switching 1 Answer