Hey there, I’ve been trying out the RPG inventory system you may have seen over at the Showcase forum, and I wanted to Put in a custom skin. So I looked up the documentation and it said All I had to do was put in this code after the function.OnGui(){
GUI.skin = customSkin;
(with customSkin being the name of my skin)
I tried this and received many errors. Including
Assets/Scripts/Inventory.js(128,20): BCE0005: Unknown identifier: 'customSkin'.
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUISkin.BuildStyleCache ()
UnityEngine.GUISkin.OnValidate ()
UnityEngine.ScriptableObject:.ctor()
UnityEngine.ScriptableObject:.ctor()
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUISkin.BuildStyleCache ()
UnityEngine.GUISkin.OnValidate ()
UnityEngine.ScriptableObject:.ctor()
UnityEngine.ScriptableObject:.ctor()
Sorry if I sound a bit stupid about this stuff, I only have limited knowledge of C#. Here is the script
function OnGUI()
{ GUI.skin = customSkin;
ix = Input.mousePosition.x;
iy = Input.mousePosition.y;
GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3(Screen.width / 1024.0, Screen.height / 768.0, 1));
var transMouse = GUI.matrix.inverse.MultiplyPoint3x4(Vector3(ix, Screen.height - iy, 1));
//GUI.DrawTexture (Rect(0,0,1024,768),emptyTex);
GUI.Label (Rect (800, 20, 200, 20), "Fullscreen:");
if (GUI.Button (Rect (880, 20, 50, 20), togglefullscreen)) {
Screen.fullScreen = !Screen.fullScreen;
if (togglefullscreen == "On"){
togglefullscreen = "Off";
}
else
{
togglefullscreen = "On";
}
}
(that isnt where it ends, its a long code, but it is the part that is mucking up. If you need the entire thing, I can show it.
thanks for your help