public override void InitParent(Object prefab, string category) { base.InitParent(prefab, category); rootTransform = GameObjectUtil.GetOrNewGameObject("Pools", null).transform; categoryTransform = rootTransform.GetOrNewGameObject(category).transform; }
/// <summary> /// 获取该gameObject下的组件,不包括剔除的组件类型 /// </summary> /// <param name="self"></param> /// <param name="excludeComponentTypes">剔除的组件类型</param> /// <returns></returns> public static Component[] GetComponentsExclude(this GameObject self, params Type[] excludeComponentTypes) { return(GameObjectUtil.GetComponentsExclude(self, excludeComponentTypes)); }
/// <summary> /// 获取该gameObject下的组件,不包括剔除的组件类型 /// </summary> /// <param name="self"></param> /// <param name="excludeComponentTypes">剔除的组件类型</param> /// <param name="excludeSplit"></param> /// <returns></returns> public static Component[] GetComponentsExclude(this GameObject self, string excludeComponentTypes, string excludeSplit = StringConst.String_Vertical) { return(GameObjectUtil.GetComponentsExclude(self, excludeComponentTypes, excludeSplit)); }
/// <summary> /// 销毁子孩子节点 /// </summary> /// <param name="self"></param> public static void DestroyChildren(this GameObject self) { GameObjectUtil.DestroyChildren(self); }
/// <summary> /// 只有包含全部的Components才会返回True /// </summary> /// <param name="self"></param> /// <param name="types"></param> /// <returns></returns> public static bool IsHasComponents(this GameObject self, params Type[] types) { return(GameObjectUtil.IsHasComponents(self, types)); }
/// <summary> /// 使某个类型的组件enable /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="enable"></param> public static void EnableComponents <T>(this GameObject self, bool enable) where T : MonoBehaviour { GameObjectUtil.EnableComponents <T>(self, enable); }
public static void EnableComponents(this GameObject self, Type type, bool enable) { GameObjectUtil.EnableComponents(self, type, enable); }
public static void SetPropertyValue(this GameObject self, string propertyName, object value, object[] index = null, params Type[] excludeComponentTypes) { GameObjectUtil.SetPropertyValue(self, propertyName, value, index, excludeComponentTypes); }
/// <summary> /// 调用callMethod的方法 /// </summary> /// <param name="c"></param> /// <param name="methodName"></param> /// <param name="excludeComponents"></param> /// <param name="args"></param> public static void Invoke(this GameObject self, string methodName, string excludeComponentTypes = null, params object[] args) { GameObjectUtil.Invoke(self, methodName, excludeComponentTypes, args); }
public static T GetPropertyValue <T>(this GameObject self, string propertyName, T defaultValue, object[] index = null, params Type[] excludeComponentTypes) { return(GameObjectUtil.GetPropertyValue(self, propertyName, defaultValue, index, excludeComponentTypes)); }
public static void SetFieldValue(this GameObject self, string fieldName, object value, params Type[] excludeComponentTypes) { GameObjectUtil.SetFieldValue(self, fieldName, value, excludeComponentTypes); }
public static T GetFieldValue <T>(this GameObject self, string fieldName, T defaultValue, params Type[] excludeComponentTypes) { return(GameObjectUtil.GetFieldValue <T>(self, fieldName, defaultValue, excludeComponentTypes)); }
public static Component GetOrAddComponent(this GameObject self, Type type) { return(GameObjectUtil.GetOrAddComponent(self, type)); }
/// <summary> /// 有T返回T,没T添加T /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <returns></returns> public static T GetOrAddComponent <T>(this GameObject self) where T : Component { return(GameObjectUtil.GetOrAddComponent <T>(self)); }