15 T component =
self.GetComponent<T>();
17 if (component ==
null) Debug.LogError(
"Could not find " + typeof(T) +
" on " +
self.name);
29 self.layer = newLayer;
31 foreach (Transform child
in self.transform)
Extensions for GameObject
static void SetLayerRecursively(this GameObject self, int newLayer)
static T GetComponentRequired< T >(this GameObject self)
Get a component. Log an error if it is not found.