DeepSearch

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Removing all content from page)
m (Text replace - "</javascript>" to "</syntaxhighlight>")
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{Stub}}
  
 +
==JS Script==
 +
<syntaxhighlight lang="javascript">
 +
 +
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;
 +
}
 +
</syntaxhighlight>
 +
==C# Script==
 +
<syntaxhighlight lang="csharp">
 +
  static public Transform deepSearch(Transform t, string s)
 +
  {
 +
      Transform dt = t.Find(s);
 +
      if (dt != null)
 +
          return dt;
 +
      else
 +
      {
 +
          foreach (Transform child in t)
 +
          {
 +
              dt = deepSearch(child, s);
 +
              if (dt != null)
 +
                  return dt;
 +
          }
 +
      }
 +
      return null;
 +
  }
 +
</syntaxhighlight>

Latest revision as of 20:52, 10 January 2012

This article is a stub.

You can help UnifyWiki by expanding it.


[edit] JS Script

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;
}

[edit] C# Script

   static public Transform deepSearch(Transform t, string s)
   {
       Transform dt = t.Find(s);
       if (dt != null)
           return dt;
       else
       {
           foreach (Transform child in t)
           {
               dt = deepSearch(child, s);
               if (dt != null)
                   return dt;
           }
       }
       return null;
   }
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox