Hey all,
So I was working on some of the tutorials in the book “Unity Game Development Essentials” by Will Goldstone and for some reason the variables in one of the GUI scripts won’t show up in the inspector…HELP!
Here’s the code:
static var charge : int = 0
var charge1tex : Texture2D;
var charge2tex : Texture2D;
var charge3tex : Texture2D;
var charge4tex : Texture2D;
var charge0tex : Texture2D;
function Start(){
guiTexture.enabled = false;
charge = 0;
}
function Update () {
if(charge == 1){
guiTexture.texture = charge1tex;
guiTexture.enabled = true;
}
else if(charge == 2){
guiTexture.texture = charge2tex;
}
else if(charge == 3){
guiTexture.texture = charge3tex;
}
else if(charge == 4){
guiTexture.texture = charge4tex;
}
else{
guiTexture.texture = charge0tex;
}
}
I’m using the free version of Unity…not sure if that matters. I’m actually pretty new to coding and have mostly been doing game dev from the art side of things.