I’ve searched and searched but can’t find nor figure out how to apply a GUISkin in C#.
Is the closest I’ve gotten, but attempting to do something similar in C# is not doing anything.
Any help would be appreciated, thank you in advance.
I’ve searched and searched but can’t find nor figure out how to apply a GUISkin in C#.
Is the closest I’ve gotten, but attempting to do something similar in C# is not doing anything.
Any help would be appreciated, thank you in advance.
using UnityEngine;
public class MyTest : MonoBehavour
{
public GUISkin _theSkin = null;
void OnGUI()
{
if (_theSkin != null)
{
GUI.skin = _theSkin;
}
}
}
Hope that helps,
-Jeremy
Yes, that’s perfect thank you.
I do have one more question, however.
I used your example and I was able to add the skin in the inspector, but none of the custom changes I made altered the GUI elements. For example, in the GUISkin (called _mySkin). I changed every possible value of text color in the skin for a button yet, nothing changed the default styles on the button.
Is there anything specific you have to do to make the changes take affect? From my understanding there wasn’t anything so I’m a bit confused.
Again, I appreciate any help and thanks in advance. This community is amazing.
Are you setting the skin in the same OnGUI function as your GUI code is?
Yes. That was one of the first things I made sure of. I also tried applying the skin to different scenes and different OnGUI functions while I was trying to debug it.
http://forum.unity3d.com/viewtopic.php?p=90320#90320
If you download the skins in this thread, they include a C# script with all the basic sample controls configured in C#.