I want to create a function, that receives the name of the gameObject, and disable the renderer on all childs in this gameobject, but when I compile the script the debbuger says:
Assets/Scripts/calidad-rendimiento/lods/lods.js(8,11): BCE0020: An instance of type 'UnityEngine.Component' is required to access non static member 'gameObject'.
Here is my code:
static function disable_hab (name_hab : String){
var hab = gameObject.Find(name_hab).GetComponentsInChildren( Renderer );
for (var child : Renderer in hab) {
child.renderer.enabled = false;
}
}
Thanks and sorry for my English ;)