duck

duck

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