In summary: Assets/Scripts/onSubmitLabelNameJS.js(5,66): BCE0020: An instance of type 'UILabel' is required to access non static member 'text'.
In general, I need GetComponent from Input / UILabel in my script "SubmitLeaderBoard.js" Maybe can I do it in C#? Then how do GetComponent from C# to JS?
Rephrase the question: How do I send OnSubmit "Player Name" from the Input / UILabel in my script "SubmitLeaderBoard.js" in the string variable "username"?
publicvar username:String="";
Title: Re: 'UILabel' is required to access non static member 'text'...
Post by: ArenMook on July 31, 2012, 10:40:46 PM
I don't know unity script. Only C#. In C#, instead of doing this:
UILabel.text
You need to do something like this:
GetComponent<UILabel>().text
UILabel is a type, and you need an instance of this type.
I explained this yesterday in another thread: http://www.tasharen.com/forum/index.php?topic=109.msg6107#msg6107
This question falls into "how do I use Unity" category. :|
Title: Re: 'UILabel' is required to access non static member 'text'...
Post by: JRoch on August 01, 2012, 12:55:25 AM
If I'm reading what he's trying to do right (looks like that jscript is attached to the same gameobject that has the UILabel attached to it) then in C# it would look something like this: