/// <summary> /// Apply style for the specified gameobject. /// </summary> /// <param name="target">Gameobject.</param> /// <param name="stylableOnly">Is style should be applied only for objects with IStylable component?</param> public virtual void ApplyTo(GameObject target, bool stylableOnly = false) { var stylable = new List <IStylable>(); Compatibility.GetComponents(target, stylable); var applied_for_children = false; if (!stylableOnly && (stylable.Count == 0)) { var components = new List <Component>(); Compatibility.GetComponents(target, components); foreach (var component in components) { applied_for_children |= ApplyTo(component); } if (!applied_for_children) { applied_for_children |= TMProSupport(Text, target); } } foreach (var component in stylable) { applied_for_children |= component.SetStyle(this); } if (!applied_for_children) { foreach (Transform child in target.transform) { ApplyTo(child.gameObject, stylableOnly); } } }