It would be nice if the JavaScript syntax highlighting could be applied to the unityscript tag.
I know I can enable it for individual posts, but the tag should default to the JavaScript syntax highlighting.
It would be nice if the JavaScript syntax highlighting could be applied to the unityscript tag.
I know I can enable it for individual posts, but the tag should default to the JavaScript syntax highlighting.
Just pulling in some Unity script from a question to see what it looks like (forcing the syntax highlighting with <!-- language: lang-js -->
):
@script RequireComponent(MeshFilter)
@script RequireComponent(MeshRenderer)
private var matarray : Material[] = new Material[2];
var mat : Material;
var mat2 : Material;
function Start () {
matarray[0] = mat;
matarray[1] = mat2;
for (var child in transform)
child.position += transform.position;
transform.position = Vector3.zero;
transform.rotation = Quaternion.identity;
var meshFilters = GetComponentsInChildren(MeshFilter);
var combine : CombineInstance[] = new CombineInstance[meshFilters.Length-1];
var index = 0;
for (var i = 0; i < meshFilters.Length; i++) {
if (meshFilters[i].sharedMesh == null)
continue;
combine[index].mesh = meshFilters[i].sharedMesh;
combine[index++].transform = meshFilters[i].transform.localToWorldMatrix;
renderer.sharedMaterials = matarray;
meshFilters[i].active = false;
}
GetComponent(MeshFilter).mesh = new Mesh();
GetComponent(MeshFilter).mesh.CombineMeshes(combine);
renderer.active = true;
//Here seems to be the trouble.
renderer.sharedMaterials = matarray;
}
Why? UnityScript is nothing like JavaScript. The syntaxes are completely different.
If you want a UnityScript syntax highlighter then ask for that feature, but asking for UnityScript to be highlighted by the JavaScript highlighter is just wrong when the two languages are not even close to having compatible syntaxes.
new Type()
whereas in UnityScript you can put a type after any function or variable as in var foo : someType
or function() : someType
. That means the 2 languages need different rules to figure out where the types are so they can apply the right styles. They aren't the same.