duck

duck

Jun 18th, 2010
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. @HideInInspector()
  3. var root : Clickable;
  4.  
  5. function Start() {
  6.  
  7.     if (root == this)
  8.     {
  9.         SpreadToChildren();
  10.     }
  11. }
  12.  
  13. function SpreadToChildren()
  14. {
  15.     for (Collider c in GetComponentsInChildren(Collider))
  16.     {
  17.         if (c.GetComponent(Clickable) == null)
  18.         {
  19.             c.gameObject.AddComponent(Clickable);
  20.             c.root = this;
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment