- Home /
How to retrieve GUIX element property?
Hello everyone, I was wondering if anyone could help me a little bit.
I installed GUIX demo, made a camvas, added a few objects, saved it, and then I added the showCanvas script to my empty scene. So, the canvas is showing, now I want to interact with the objects so I made the following:
A label, a textField called joinIPField, and a button called joinButton.
So, GUIX automatically adds the following code:
function joinButton_Click( sender : System.Object, eventData : GUIX.EventData ) {
//Enter Your Click Handling Code Here...
}
.
So then, I add my own little piece of code: .
.
function joinButton_Click( sender : System.Object, eventData : GUIX.EventData ) {
ConnectToServer(joinIPField.Text);
}
Now, the problem is that it doesn't work. How do I access a GUI object property using GUIX?
The error message is 125*Assets/GUIX Generated/mainMenuCanvas/mainMenuCanvas_Logic.js(19,10): BCE0044: expecting }, found 'joinIPField'.*
Thanks very much for your help! -- Kevin
Answer by kevinseligmann · Oct 29, 2011 at 11:22 PM
So, I figured it out on my own. If you want to access a GUI component using GUIX from another's component event, it's like this:
_canvas.componentName.property
In my case, it was ConnectToServer(_canvas.joinIPField.Value);
Your answer
Follow this Question
Related Questions
Select multiple objects 1 Answer
Editing PlayerPrefs directly in plist 2 Answers
Access local method variable in derived class 2 Answers
Material doesn't have a color property '_Color' 4 Answers
GUI Label does not show sometimes 0 Answers