I am trying to follow those tutorials (Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn), but I find myself thinking if it was only made for C# users ?
Third, the tutorial don’t tell me how to make it work in Unity Editor. Do I need to only attach the FruitSalad class to an object, or do I need also the Fruit and Apple Class to be also attached to that game object.
What do you think ?
I’m not sure, but it sounds like you might be a little confused over the use of classes in Unity. All scripts that are attached to gameobjects are monobehaviours. This means that they inherit from the monobehaviour class. This is quite obvious (once you know about inheritance) in C# since you can see : MonoBehaviour at the top of every class declaration. However, in JS, since the declaration is implicit this isn’t as obvious. If you try to create a “new” instance of a monobehaviour then you will get the error that you mentioned.
My honest advice in this situation would be to have a go at C#. That may seem daunting or unpleasant (you’ve already spent the effort learning JS, so why should you bother?) but it will be worthwhile in the long run. Having already learnt JS, you’re more than halfway there! Before intermediate scripting, the differences are pretty much just variable and function declarations. They are all summarised in the beginner scripting lesson comparing the two languages.
Again, this may sound like a lot of effort, but it’s less than you think and it will be worth while in the long run. Think of how much more powerful your games can be with all the OOP tools working for you!
I hope this helps.