Hi i am trying to change my Texture inside GUI.Window when the Player is hit or he does a hit to the enemy and have there no Texture if he does nothing from these two.
So far i’ve got the Textures working, but when i am in the game and do nothing the first Texture is always loaded inside my Window, i want to have that window clear and Texture to appear only when i do a hit or receive a hit.
#pragma strict
var mtSkin: GUISkin;
var hudPanelWidth : int;
var hudPanelHeight : int;
var attackicon : Texture;
var defenceIcon : Texture;
private var _hudWindowRect : Rect = new Rect(0,Screen.height - 90,250,100);
private static var _hudWindowID : int = 3;
private var console : Console;
private var player : GameObject;
function Start () {
player = GameObject.FindGameObjectWithTag("Player");
console = player.GetComponent(Console);
}
function OnGUI () {
GUI.skin = mySkin;
GUI.backgroundColor = Color.black;
GUI.color = Color.white;
_hudWindowRect = GUI.Window(_hudWindowID, _hudWindowRect, AttackPanelHUD, GUIContent (console.enemyAttackLabel, defenceIcon) || GUIContent (console.playerAttackLabel, attackicon ));
}
function AttackPanelHUD (_hudWindowID) {
// var temp : String = "";
// temp = console.enemyAttackLabel;
//
//
//
// var temp2 : String = "";
// temp2 = console.playerAttackLabel;
}
OK just tell OnGUI or Console or whatever to only draw any of the textures you your doing one of those things, if not it will do nothing. (use IF’s) do this before you determine which texture to display
please format your code
– Fornoreason1000