x


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");
}
more ▼

asked May 15 '10 at 01:17 AM

vdizzle gravatar image

vdizzle
57 9 10 15

Post code by hilighting it and clicking the "Code" button in the toolbar.

May 15 '10 at 05:35 AM qJake

i caannot read c#...can you write that in javascript?

May 15 '10 at 02:33 PM vdizzle
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
// 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?

more ▼

answered May 15 '10 at 05:37 AM

qJake gravatar image

qJake
11.6k 43 78 161

i cannot read c#--is it possible for you to write that in javascript?

May 15 '10 at 02:50 PM vdizzle

I don't know Javascript (and I don't like Unity's implementation of it), so no, I can't.

May 15 '10 at 08:45 PM qJake
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x496
x478
x391

asked: May 15 '10 at 01:17 AM

Seen: 1050 times

Last Updated: Jul 11 '10 at 12:26 AM