- Home /
Syntax is not highlighted. Plz help.I am new to unity
][1]][1]
Hi I am new to Unity.The problem I am facing that in MonoDevelop the predefined functions and classes are not highlighted.So,I am unable to see if I have written it correctly or not.Can you suggest what should I do??
Your onCollisionEnter() would never be highlighted since at syntax checking time, there is no way for the checker to know if you are trying to use an override or declaring your own function.
But I find the lack of auto-complete to be more of a problem with Javascript than with C#. If you have any error above your current position, the checker seems to be confused and give up (i.e. not show autocomplete entries). If I'm not getting a autocomplete list, I switch back to Unity and fix any errors above the current position. The C# checker seems to be smarter in that it seems to be able to recover from errors better.
Answer by numberkruncher · May 26, 2013 at 08:30 PM
What you are seeing is the intended behaviour of MonoDevelop since the identifiers which you have highlighted in the screenshot are just regular methods and properties like any other.
Syntax errors are usually underlined in red wiggly lines within MonoDevelop, though rest assured, actual errors will be logged in the console window :)
But it should give me auto complete atleast..How would I know while coding that I am going right or wrong?
If you want better auto-complete with $$anonymous$$onoDevelop then you would probably be better off using C#. On a side note, the syntax is very similar to UnityScript, and if you are just starting out then C# might be a better starting point anyway.
You should probably get used to using the Unity documentation since it documents each function and class. And of course, the console window will reveal when you have errors and you can use that in conjunction with the API documentation.
I agree with @robertbu, it would be nicer if UnityScript had autocomplete. Perhaps you should consider using C# ins$$anonymous$$d if you rely upon autocomplete...
Actually, the thing is I heard javascript is easy for beginners.Is there any other editor which can give me autocomplete and highlights the methods.Like here onCollisionEnter is not a method created by me but still it is not showing it in color.
$$anonymous$$onoDevelop does not distinguish between functions that are exposed by the Unity API, the $$anonymous$$ono API nor your custom functions.
UnityScript is similar to regular JavaScript, though it seems far more comparable with ActionScript. In general there is more documentation for C# since it is a very widely used language whereas UnityScript is unique to Unity.
Here is an example of what I mean regarding the differences between UnityScript and C#:
// UnityScript (aka JavaScript)
import System.Collections.Generic;
public var someString:String;
public var someListOfStrings:List.<String>;
function Awake() {
someString = "Hello World!";
someListOfStrings = new List.<String>();
}
// C#
using UnityEngine;
using System.Collections.Generic;
class YourScriptName : $$anonymous$$onoBehaviour {
public string someString;
public List<string> someListOfStrings;
void Awake() {
someString = "Hello World!";
someListOfStrings = new List<string>();
}
}
Anyhow, I hope that you find a solution which you find comfortable with. If you prefer the UnityScript syntax then fantastic! If you are entirely new to program$$anonymous$$g then you may find it easier to get started with C# ins$$anonymous$$d. Just my opinion :)
Thankyou.I am trying javascript since I can find many tutorials of it.Let's see how it goes.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102949im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
MonoDevelop 5.9 adding syntax highlighting .json file does nothing (WINDOWS, UNITY 5.3.1p1) 2 Answers
optional function parameters in javascript and c# 4 Answers
class, function and variable capitalisation 3 Answers
Syntax prob, UCE0001 error c#sharp to javascript 1 Answer
Far Clipping Range syntax 1 Answer