- Home /
BUG: GUISkin not updating in real-time when using name reference.
When using a custom GUIStyle created in a GUISkin, there is a difference in the way you reference it. If you reference it by the index, any changes made to it in the inspector will update style in real-time. But any style referenced by the name, will not recieve changes before restarting playmode. As posted in the comments, this has not always been the case.
[..]
GUI.skin = GUISKIN;
GUI.Box(rect, string, "NAMEOFSTYLE"); /* Does not update real time */
GUI.Box(rect, string, GUISKIN.customStyles[0])); /*Does update real time */
[..]
Yeah, was going to ask the same. It seems like a bug to me since the GUI was updating in realtime for both situations in version 4.2.1.
First create a GUISkin in your project: Assets> Creat> GUISkin Then try this code, put in a empty GameObject:
using UnityEngine; using System.Collections;
public class database: $$anonymous$$onoBehaviour {
public GUISkin GuiCustom;
void Start { GUI.skin = GuiCustom; GUI.Box (new Rect (140,445,300,310), "Title!"); }
Drag the GUISkin that is in your project to the class "GUISkin GuiCustom", the empty GameObject.
Done it all start playing and click the GUISkin that was placed in your project and change the option: BOX
Answer by Kamuiyshirou · Apr 29, 2014 at 10:07 PM
First create a GUISkin in your project: Assets> Creat> GUISkin
Then try this code, put in a empty GameObject:
//////////////////
using UnityEngine;
using System.Collections;
public class database: MonoBehaviour {
public GUISkin GuiCustom;
void Start {
GUI.skin = GuiCustom;
GUI.Box (new Rect (140,445,300,310), "Title!");
}
}
//////////////////
Drag the GUISkin that is in your project to the class "GUISkin GuiCustom", the empty GameObject.
Done it all start playing and click the GUISkin that was placed in your project and change the option: BOX
It does not. It's commendable that he tried to answer the question, but it was utterly incorrect and I suspect he did not even read the problem posted.
Your answer
Follow this Question
Related Questions
How to make a GUI that isnt alpha transparent? 1 Answer
GUI.skin persisting through other OnGUI calls 1 Answer
Simple GUI Question 1 Answer