- Home /
checking multiple textures at once using functio update
Hi. is it possible to check multiple textures at once using function update? This script only checks to see if one texture is enabled. What if I want to check to see if multiple textures are enabled at the same time. If i apply another variable-it of course wont add an additional slot because its an update function. How can i add an additional slot and check to see if addition textures are enabled using function updated()?
function Update(){ var myGUI: GUITexture=gameObject.GetComponent(GUITexture);
if(myGUI.enabled==true) print("test"); }
Post code by hilighting it and clicking the "Code" button in the toolbar.
Answer by qJake · May 15, 2010 at 05:37 AM
// C#
void Update()
{
GUITexture[] textures = GetComponents(typeof(GUITexture)) as GUITexture[];
foreach(GUITexture g in textures)
{
if(g.enabled)
{
print("test");
}
}
}
You want something like this?
i cannot read c#--is it possible for you to write that in javascript?
I don't know Javascript (and I don't like Unity's implementation of it), so no, I can't.
Your answer
Follow this Question
Related Questions
Help with If statement INSIDE if statement!! 2 Answers
List/Array Not Updating 2 Answers
bool value does not change 1 Answer
Run function once, is this method appropriate? 2 Answers
update() too fast? 2 Answers