Mono Behaviours??

Having problems with attaching some of my scripts to GameObjects …
Keep getting

Can't add script behaviour Rocket. 
The script needs to derive from MonoBehaviour!

Not sure if I’ve quite got the concept …
does this mean I should call the Rocket script up from another?

It worked in the FPS tutorial, I’m using the same method … I just can’t seem to identify what the difference is!

please scuse me dumbness!

That error can happen if the scripts are still compiling (indicated by the spinning circle in the lower right corner of the Unity window).

–Eric

Also, if the script is C#, make sure you have : MonoBehaviour after the class name.

See point one: http://unity3d.com/Documentation/ScriptReference/index.Writing_Scripts_in_Csharp.html

Um … I wasn’t using C# so the issue wasn’t relative to the class name … (although thanks for pointing me to the resource … http://unity3d.com/Documentation/ScriptReference/index.Writing_Scripts_in_Csharp.html … I’m sure it’ll prove to be useful …

I was using Java from within Unity (or rather it’s associated script editor … Unitron) that’s why the issue surprised me … turns out that another script that I’m not using but that I’d loaded in as an asset for reference was the culprit … it must have interfered with the compiling … or something … anywayz …after commenting out the offending line the scripts are behaving themselves now …

thanks for your help guys … It’s fantastic to be able to get a bit of guidance, tips and pointers

cheers for now

That error can also occur if you try to add a script to a GameObject when the script has never been successfully compiled. Keep an eye out for the red error messages at the bottom of the Unity editor. Maybe that was it? But oh well, guess you’re back rolling again. :slight_smile:

Cheers,
-Jon

It was another script that was causing the issue … but essentially that’s what happened.
The unused script was causing the compiler issues … good to know.
There’s quite a lot to take in as a nooB so I really appreciate the tips and pointers … it’s great to be able to isolate the issues as quickly as possible as it frees me up to learn about unity and what it’s capable of … thanks again!

cheers for now