The name 'LevelGrid' does not exist in the current context

Hi!

I am stuck in the part of the Level Grid creation where we are supposed to get the grid position from the LevelGrid class, but for some reason, the LevelGrid class is not accessible from the Unit class:

My LevelGrid class looks like this:

What could be the problem here?

Cheers!

If you save the files, and go into Unity, is this error showing up in the Unity Console?

You might need to regenerate the project files within Unity by going to Edit/Preferences/External Tools and clicking the Regenerate Project Files button.

If that still doesn’t work, exit Unity and Visual Studio Code, and then open the Project folder in Explorer. Delete the Library file and reload Unity. Once again regenerate the project files and then return to Visual Studio Code.

1 Like

Hi Brian,

thanks for your reply, what worked for me was the last of the different proposed solutions, so going to the Scripts folder having both Unity and Visual Studio Code closed, and deleting the .meta files both the LevelGrid and the Unit solved the issue for me!

Thanks again for the tips! Cheers!

It’s rare, but sometimes Unity just loses it’s place…

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms