DeepSearch

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Joseph05408 (Talk); changed back to last version by Llavigne)
(Script)
Line 1: Line 1:
==Script==
+
==JS Script==
 
<javascript>
 
<javascript>
  
Line 17: Line 17:
 
return null;
 
return null;
 
}
 
}
 +
</javascript>
 +
==C# Script==
 +
<csharp>
 +
  static public Transform deepSearch(Transform t, string s)
 +
  {
 +
      Transform dt = t.Find(s);
 +
      if (dt)
 +
          return dt;
 +
      else
 +
      {
 +
          foreach (Transform child in t)
 +
          {
 +
              dt = deepSearch(child, s);
 +
              if (dt)
 +
                  return dt;
 +
          }
 +
      }
 +
      return null;
 +
  }
 +
</csharp>

Revision as of 18:23, 7 December 2009

JS Script

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

C# Script

<csharp>

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

</csharp>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox