public static GameObject PlayFx(Transform hook, Transform anchor, GameObject clipper, string fx_path, float life_time, bool is_ui, int order_offset = 0) { if (!is_ui) { #if ART_USE && UNITY_EDITOR GameObject obj = UnityEditor.AssetDatabase.LoadAssetAtPath(fx_path, typeof(GameObject)) as GameObject; if (obj != null) { obj = Object.Instantiate <GameObject>(obj); Transform t = obj.transform; t.SetParent(hook, false); obj.SetActive(true); Util.SetLayerRecursively(obj, LayerMask.NameToLayer("UIScene")); //re-position if (anchor != null && anchor != hook) { t.position = anchor.position; } if (life_time < 0.0001f) { FxDuration fxd = obj.GetComponent <FxDuration>(); if (fxd != null) { life_time = fxd.duration; } } Object.Destroy(obj, life_time > 0.0001f ? life_time : 5); Debug.Log("PlayFx " + hook.name + ", " + fx_path + ", " + life_time); } return(obj); #else //Debug.Log("TODO: PlayFx"); #if IN_GAME int fxId = 0; CFxOne fxOne = CFxCacheMan.Instance.RequestFxOne(fx_path, -1, out fxId); if (fxOne != null) { Transform t_fx = fxOne.transform; GameObject g_fx = fxOne.gameObject; t_fx.SetParent(hook, false); //re-position if (anchor != null && anchor != hook) { t_fx.position = anchor.position; } //g_fx.SetActive(true); Util.SetLayerRecursively(g_fx, LayerMask.NameToLayer("UIScene")); fxOne.Play(life_time); return(fxOne.gameObject); } return(null); #else return(null); #endif #endif } else { return(UISfxBehaviour.Play(fx_path, anchor.gameObject, hook.gameObject, clipper, life_time, 20, order_offset)); } }