Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @HideInInspector()
- var root : Clickable;
- function Start()
- {
- if (root == null)
- {
- SpreadToChildren();
- }
- }
- function SpreadToChildren()
- {
- for (var c : Collider in GetComponentsInChildren(Collider))
- {
- if (c.GetComponent(Clickable) == null)
- {
- var clickable = c.gameObject.AddComponent(Clickable);
- clickable.root = this;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment