Assign myGUISkin in javascript

Hi,

I want to assign my own GUISkin to the GUI.skin in javascript. Till now I have written this code (shown bellow) but I don't know how to assign myGUISkin = the GUI skin I created in the inspector.

So, the whole context is like this: the GUISkin I created is called "EsGUIskin.guiskin" and I have it in my project folder.

And in a script I have written:

var myGUISkin : GUISkin;

***BUT HOW do I SAY THAT myGUISkin=EsGUIskin.guiskin?????***

function OnGUI () {

    GUI.skin=myGUISkin;

//whatever here
}

Thanks in advance,

So after many tries, I thought (with my head) and the solution is as simple as this, code shown below:

var myGUISkin : GUISkin;

function Start () {
myGUISkin = Resources.Load("EsGUIskin");
}

function OnGUI () {

    GUI.skin = myGUISkin;

    GUI.Box (Rect (10, 10, 100, 20), "Espaol o");
    GUILayout.Box ("Espaol o");
    }

Cheers

Just drag the skin onto the slot in the inspector.

Hi, try this…(the name of my skin is ‘My Skin’ in the ‘Assets/SKIN’ folder).

var myCustomSkin : GUISkin;

function Start () {
myCustomSkin = Resources.LoadAssetAtPath("Assets/SKIN/MySkin.GUISkin", GUISkin);
}

function OnGUI () {
  GUI.skin = myCustomSkin;
}