Newbie question (165829)

I am very new to Unity, I have just recently installed it and I am just curious if scripting should be consistent (ex: when you use C#, use C# to all scripts and avoid javascript) (or if it’s easy to have variables in C# that can be called in a separate javascript?)

Thanks

2 Answers

2

It’s possible to mix scripts but it’s not recommended - you’ll end up having to do a bit of manual work to ensure that libraries are compiled in the correct order in order for C# ↔ UnityScript assemblies can see each other.

Stick to one language in your project and, unless you’ve got a really good reason not to, make it C#.

Thank you for the Answer @tanoshimi, if I am to use javascript, would it limit my capabilities in the creation? I am somehow comfortable with javascript which I have already used before.

Unityscript is slightly less powerful than C#, but you won't notice the difference until you start to use more advanced features. Note that if you know javascript from the web, Unityscript (sometimes referred to as javascript) is quite different - so you'll have to relearn quite a bit anyway.

You’re able to use both, but there’s not much of a use for it. I’d recommend going with the C# implementation. There’s plenty of great documentation on it, and statically typed languages (like C#) are just a lot less messy.

Difficulty-wise, I wouldn’t say C# is any harder to learn than UnityScript, and what you learn will be applicable in more areas than just Unity development.

OnMouseOver is called anytime the mouse is over a "GUIElement or a Collider" so the object your trying to select must be a 2d gui element or must include some form of a collider. the reason for the error might be that camera is not being set to the main camera did you include the start function as well?