DeepSearch

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "</csharp>" to "</syntaxhighlight>")
m (Text replace - "</javascript>" to "</syntaxhighlight>")
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
  
 
==JS Script==
 
==JS Script==
<javascript>
+
<syntaxhighlight lang="javascript">
  
 
static function deepSearch (t : Transform, s : String) : Transform
 
static function deepSearch (t : Transform, s : String) : Transform
Line 19: Line 19:
 
return null;
 
return null;
 
}
 
}
</javascript>
+
</syntaxhighlight>
 
==C# Script==
 
==C# Script==
 
<syntaxhighlight lang="csharp">
 
<syntaxhighlight lang="csharp">

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