color doesn't exist in c# ?

This used to work fine in javascript, but in c# i get the error “guiElement does not contain a definition for color”.

GameObject goTextInfo = GameObject.Find(“2ndlaunch”) ;
goTextInfo.guiElement.color = newcolor;

also i was wondering , since my script is attached to 2ndlaunch game object, if it would be possible to do something like:

guiElement.color = newcolor ;

( since i can do transform.blabla, why not guiElement.blablabla )

Thank you
Patricia.

Since there’s no GameObject.guiElement property, you need to use guiText or guiTexture instead of guiElement. Not sure why it would work in Javascript, because that property doesn’t exist there either.

Only the components listed in the Inherited Members section of the MonoBehaviour page can be accessed in this way. For any other kind of component, you must use GetComponent to get your own reference to the component you want.

Indeed i wondered why guiElement didn’t turn red when i typed. Works in javascript though.

Patricia.

Well, actually, it does. Not sure if it’s been deprecated or something, but at least Javascript code using it compiles and works.

–Eric