- Home /
copy a GUIStyle into a new GUIStyle var using JavaScript
Hi,
I would like ot know how to copy a GUIStyle using JavaScript.
In C# it is like this: GUIStyle Label2 = new GUIStyle(GlobalGUISkin.GetStyle("label"));
But I ma not able ot do it in JavaScript.
Thak you in advance
Answer by kennypu · Mar 14, 2011 at 07:09 PM
in javascript the syntax would be:
var Label2:GUIStyle = new GUIStyle(GlobalGUISkin.GetStyle("label"));
Thank you kennypu.
Unfortunately your solution creates the following error: "$$anonymous$$ identifier: 'GlobalGUISkin'"
Does not work for me:
GUISkin skin = GUI.skin;
GUIStyle labelStyle = new GUIStyle(skin.GetStyle("label"));
labelStyle.fontSize = 34;
GUI.Label(new Rect(X, Y, X2, Y2), "Test",labelStyle);
The font size does not change. Is there a different way under C#?
Answer by davvilla · Oct 14, 2013 at 06:43 PM
This worked for me:
GUIStyle newStyle = new GUIStyle(GUI.skin.GetStyle("button"));
Your answer
Follow this Question
Related Questions
GUISkin Problem 1 Answer
How to use a global variable in javascript to set other variables data 0 Answers
Help make my Timer GUI stay in the same position 2 Answers
Setting Scroll View Width GUILayout 1 Answer
Fading a text gui style 3 Answers