DeepSearch

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: ==How to use== drop the script on a gameobject, returns a transform. deepSearch ( String ) : Transform)
 
(How to use)
Line 2: Line 2:
 
drop the script on a gameobject, returns a transform.
 
drop the script on a gameobject, returns a transform.
 
deepSearch ( String ) : Transform
 
deepSearch ( String ) : Transform
 +
 +
==CODE==
 +
static function deepSearch (t : Transform, s : String) : Transform
 +
{
 +
var dt : Transform = t.Find (s);
 +
if (dt)
 +
return dt;
 +
else
 +
{
 +
for (var child : Transform in t) {
 +
dt = deepSearch (child, s);
 +
if (dt)
 +
return dt;
 +
}
 +
}
 +
return null;
 +
}

Revision as of 04:10, 17 January 2008

How to use

drop the script on a gameobject, returns a transform. deepSearch ( String ) : Transform

CODE

static function deepSearch (t : Transform, s : String) : Transform { var dt : Transform = t.Find (s); if (dt) return dt; else { for (var child : Transform in t) { dt = deepSearch (child, s); if (dt) return dt; } } return null; }

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox