- Home /
Enabling and Disabling GUI Textures
In my game, I have a "Peace Mode" and a "Combat Mode." While in Peace mode, I want to have the combat textures disabled and greyed out. Do I need to make separate "greyed-out" versions? While I have the textures showing on and off when clicked, I can't quite get it working right.
void OnMouseDown() { if(PeaceButton) Mode ();
if(AttackHackButton)
HackAttack();
...etc
} void Mode() { if(!CombatMode) //bool { guiTexture.texture=CombatButton; CombatMode=true; //AttackHackButton=enabled; (Should this be a bool?) Debug.Log("Combat Mode" +CombatMode); } else { guiTexture.texture=PeaceButton; CombatMode=false; Debug.Log("Peace Mode" +CombatMode); } }
What am I missing? Thanks!
Answer by ScroodgeM · Aug 10, 2012 at 11:17 PM
best way at least in performance reason is to have two sets of textures.
on draw controls, just check the Combatode and use texture that shows the activity
can't quite get it working right.* what exactly working wrong?
I wasn't quite able to wrap my brain around what needed to happen. I've since worked out one thing, but the rest is still elusive. I added this to on$$anonymous$$ouseDown: if (Combat$$anonymous$$ode=true) { if(RangedButton) RangedAttack$$anonymous$$ode();
if(AttackHackButton) HackAttack();
if(AttackSlashButton) SlashAttack();
if(AttackThrustButton) ThrustAttack();
if(AttackUppercutButton) UppercutAttack(); }
But if I try more than one texture in the $$anonymous$$ode function(which switches between peace and combat modes) it's blank. Need some way to differentiate the different pieces. Will draw controls work for this?
show sources of both textures declaration and implementation.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to make OnGUI Texture able to be clicked 1 Answer
Toggle Only Works Once 1 Answer
Inventory image not showing up 0 Answers