Applying GUIskin problem?

Hello guys,

I am having trouble with setting my own “skin” for use in a GUI. I tried following the book I am working from, but, I am skipping ahead chapters and trying to implement features from later chapters to keep things interesting

so I’ve probably missed something quite basic. And I am hoping that one of you guys might be able to help me get this working properly. So far I haven’t noticed anything different coming up in “Game” view.

So, I am using onGUI(), I realize that this is now a legacy function, but, it’s what the book uses so it’s pretty much my only reference.

Right, I’m not so great at explaining myself so I’ll use pictures -and save myself a few thousand words :stuck_out_tongue: - I set up “myGui” skin as the following illustration shows. Like I wanted my text to be bold and wanted to change the alignment to anything other than the default, so, I could see it had changed:

Then I set up my JavaScript function lnking myGUI to it by dragging the skin on, shown thusly:

And as the last step, I put the following into my JavaScript onGUI function to make sure it used the skin.

And thus far no luck, everything looks the same as it did before setting the skin. So to anyone you can help here is a big “thankyou” in advance!

Regards.

You have to link the GUI skin to a public variable (in this case mySkin) on your script (on the gamobject) to assign it and not on the import setting for the script.

I am going to have to plead the “noob” amendment here :).

I am not following what you are saying. I did get it to work when I changed the variable in the script to the same name as the Skin and it did work for a while, but, when I made some modifications it stopped again.

So you you please tell me what I need to do again, keeping in mind I am a complete noob?

EDIT: I exited out of Unity and then it worked again?!?