How do I reference a variable by an int. The code underneath doesn’t work.
var Tex0 : Texture2D;
var Tex1 : Texture2D;
var Tex2 : Texture2D;
function UpdateSpecialAttackGUI(number : int) {
guiTexture.texture = Tex+(number);
}
How do I reference a variable by an int. The code underneath doesn’t work.
var Tex0 : Texture2D;
var Tex1 : Texture2D;
var Tex2 : Texture2D;
function UpdateSpecialAttackGUI(number : int) {
guiTexture.texture = Tex+(number);
}
You can’t construct variable name like a string, in this case I would replace variables to an array of textures:
var textures : Texture2D[];
function UpdateSpecialAttackGUI(number : int) {
guiTexture.texture = textures[number];
}
Ah yes. Of course. Thx.