public static GameObject Play(string fxPath, GameObject target, GameObject hook_point, GameObject clipper = null, float duration = -1, float secondsStayInCache = 20f, int orderOffset = 1 #if IN_GAME , LuaInterface.LuaFunction luaCall = null #endif ) { if (string.IsNullOrEmpty(fxPath) || target == null) { return(null); } UISfxBehaviour sfx = _AllCreatedList.Find(item => { return(item.Target == target && item.FxPath == fxPath); }); if (sfx == null) { GameObject sfx_obj = new GameObject("FXObj"); sfx = sfx_obj.AddComponent <UISfxBehaviour>(); _AllCreatedList.Add(sfx); } if (sfx == null) { return(null); } sfx.SetData(fxPath, target, hook_point, duration, secondsStayInCache, orderOffset); sfx.SetClipRect(clipper); if (luaCall != null) { #if IN_GAME sfx.SetOnLoadCallBack(luaCall); #endif } if (sfx._FxObject == null) { if (!sfx._IsLoading) { PrefabCacheData sfx_pf; if (_PrefabCache.TryGetValue(fxPath, out sfx_pf)) { sfx.OnPrefabLoaded(sfx_pf.Obj as GameObject); } else { sfx._IsLoading = true; #if IN_GAME Action <UnityEngine.Object> callback = (asset) => { if (sfx != null) { sfx.OnPrefabLoaded(asset); } }; CAssetBundleManager.AsyncLoadResource(fxPath, callback, false, "sfx"); #elif UNITY_EDITOR && ART_USE GameObject prefab = UnityEditor.AssetDatabase.LoadAssetAtPath(fxPath, typeof(GameObject)) as GameObject; if (!_PrefabCache.ContainsKey(fxPath)) { _PrefabCache.Add(fxPath, prefab as GameObject); } //DoPlay(fxPath, sfx_pf, sfx_obj); sfx.OnPrefabLoaded(prefab); #endif } } } else { sfx.RestartPlay(); } return(sfx.gameObject); }