public static Component AddComponent(GameObject gameObject, Type type) { ObjectFactory.CheckTypeValidity(type); if (!type.IsSubclassOf(typeof(Component))) { throw new ArgumentException("Non-Component type must use ObjectFactory.CreateInstance instead : " + type.FullName); } return(ObjectFactory.AddDefaultComponent(gameObject, type)); }