Script doesn't derive from MonoBehaviour even though it does?


Hi, I’m new to Unity and coding, and I’m trying to recreate Pong in unity as my first step in learning game dev. So far it’s been going good, but for some reason Unity thinks this script doesn’t derive from MonoBehaviour (it gives me an error message saysing “Can’t add script behaviour ‘BouncySurface’. The script needs to derive from MonoBehaviour!”)

Help would be appreciated!

(solved)

Make sure the script file name is the same as the class name and that you have no compiler errors in the console.

i think it was a bug, I restarted the project a second time now and it works. By the way, other than the error that the class doesn’t derive from MonoBehaviour there weren’t any errors, and the script and class name are the same, I think it was a bug.