nav mesh surface does not work

when I try to drag and drop nav mesh surface script to the empty game object it shows me error “Can’t add script component ‘NavMeshSurface’ because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.” anyone knows what to do?

Probably you script name is newbehivourscript or something like that check the script name.

If you talking about component you should check;

Ground static and baked after that you should have navmeshagent component on your ai thats it.

If you have troubles you can use A* algorithm.