(Solved) 'LevelManager' is not recognized on my 'LoseCollider' script

I have been at it for about an hour and I can’t figure out why it won’t work. Maybe I am missing something? It is taking me a while to understand everything but I usually pick it up after a bit. Using 4.6.9

This is the error I am getting.
error CS0246 the type or namespace ‘LevelManager’ could not be found. Are you missing a using directive or assembly reference?

Here is my ‘LoseCollider’ script

Here is my ‘LevelManager’ script

I have figured out that if I take off the ‘r’ at the end of ‘LevelManager’ on the “LoseCollider.cs” it will bring me to the win screen like it is supposed to but I can not get back to the main menu because the referenced script is missing.

Any help is appreciated, thank you.

Are you using unity 4.6 or a later version? I ask because after 4.6 there is a change to how levels are loaded and now we use SceneManager.Loadlevel.

I have taken a look at your screenshots and code and couldn’t really find anything obvious.

One thing did stand out: I noticed that you have a folder (screenshot 1) Asset/Scrtips with a pretty obvious spelling mistake. Now there is no rule that the script folder should contain no spelling mistakes, but perhaps if you see the mistake and correct it (rename the folder), it might be an easy way for Unity to lose the required script. This would mean that the LevelManager actually can’y be found.

So perhaps an addition check, are the gameobjects in the Unity editor using the right scripts? Is the scene indeed called “Win”? Are there checks you can do to see where exactly the problem lies?

I am sorry I forgot that. I am using 4.6 for this part of the course.

Thank you for your input! I went and made sure everything was spelled correctly and checked my game objects and it turned out that my collider had the wrong script. I am not sure how I missed that but thank you!

use Application.LoadLevel(“Win”);
instead of

public LevelManager levelManager;


Privacy & Terms