public GameObject PlayEffect(TypeEffect type, Vector3 pos, Vector3 rot, float time = 1f) { bool isPool = false; for (int j = 0; j < _mapper[type].Count; j++) { EffectObject efobj2 = _mapper[type][j]; if (efobj2.getAction() == false) { efobj2.ActionEffect(pos, rot); isPool = true; if (time != 0) { StartCoroutine(WatingHideEffect(efobj2, time)); } return(efobj2.gameObject); } } if (isPool == false) { Debug.LogWarning("PLEASE ADD MORE POOL: " + type.ToString()); EffectObject effectObject = Instantiate(_mapper[type][0], transform) as EffectObject; effectObject.Hide(); effectObject.ActionEffect(pos, rot); if (time != 0) { StartCoroutine(WatingHideEffect(effectObject, time)); } _mapper[type].Add(effectObject); return(effectObject.gameObject); } Debug.LogError("Not find this effect"); return(null); }