- Home /
Default References Problem
Hello guys. When i adding to my jscript class. In inspector on Default References of a Script i can't see variables. Like Texture or Camera etc. Whithout class - all works fine. Thank you!
class HelloWorld extends MonoBehaviour
{
public var Texture : Texture2D; // I dont see it on References. What's prob?
function Update()
{
}
}
Answer by tnetennba · Jun 07, 2011 at 03:47 PM
Have a look at this:
http://answers.unity3d.com/questions/11850/reference-for-unity-javascript-class-keyword-and-r.html
Unity javascript is different from the javascript you know. You do not need the class keyword and once you have removed that it will show in the references:
public var texture : Texture2D; // now you see it
function Update()
{
}
That is all the code that you need to use. The Script is a class of the type that you use to name your script so you can search for it that way using GetComponent etc.
I appreciate the intention of brevity with the way Unityscript is handled but I've converted all of my stuff to c# for this very reason. I don't like implicit stuff going on.
Your answer
![](https://koobas.hobune.stream/wayback/20220612100719im_/https://answers.unity.com/themes/thub/images/avi.jpg)