Got stuck in adding a .cs script as component to my player.
When i click on .cs script it shows issues with Mono behaviour.
Ans when i click on my player , the script component shows that u need to fix some errors and script is not loaded.
Let me know what i can do to fix it.
I do not see any errors in my script.
Could you screen shot or share the issues that are being shown with Mono Behaviour? Also, if you want to insert the code(assuming you’re copying/following the tutorial), I can glance over it as I wait for some responses on my post =)
According to this, which seems to be the same issue.
It says to delete the script in your documents/project folder. Essentially where it would be on your disk. You’ll need to reopen your project and remake the script. But this should fix your problem!
In addition no problem! Most of the small bugs/issues like this can be found as unity has seen its fair share of users. So a little searching can go a long way. Won’t always have bored guys like me on here
For lack of ideas, the final thing posted in that other forum was an antivirus was messing with his scripts. Otherwise I’m not sure =(. Wish I could help more than I have
right click the script file giving problems → reimport
Edit: Actually, I just looked at your script file. The error is telling you exactly what is wrong. Your .cs file is named “obstacle” but your class name within the file is spelt with an Uppercase O, Obstacle.
Both the name of the script and the main class within it must be exactly the same name
Your scripts have to have the same name as the class inside of them, for MonoBehaviours. You’re trying to load a component named “naval” but you’ve named the class inside of it “Player”, and it has no idea what’s going on.
Ok, looking at the other screenshots you posted, you have the same problem everywhere. C# is case sensitive. The name of your .cs file should match exactly the name of the class within the file.