示例#1
0
 public static bool HasComponent <T>(this Component component) where T : Component
 {
     return(component.GetComponent <T>() != null);
 }
示例#2
0
 public static T GetOrAddComponent <T>(this Component component) where T : Component
 {
     return(component.GetComponent <T>() ?? component.AddComponent <T>());
 }