7.7 – Accessing iGUI elements from any script

You can access iGUI elements from any script easily. Create a scene and add a panel with variableName panel1 . Now create a script with name MyScript and attach it to any gameobject. For example Main Camera. Let’s try to access panel1 from MyScript and set its width.

iGUICode_sceneName.getInstance().panel1.setWidth(1);
iGUICode_sceneName.getInstance().panel1.setWidth(1);


The only difference between C# and JS is that you have to add a “using iGUI;” line at the top of the script in C#.