public GameObject SpawnFX(GameObject fx, Vector3 position, Vector3 rotation, float vol = -1, Transform parent = null) { if (!fx) { return(null); } GameObject spawned_fx = Instantiate(fx, position, Quaternion.identity); spawned_fx.transform.parent = parent ? parent : holder.transform; if (rotation != Vector3.zero) { spawned_fx.transform.forward = rotation; } FX_Object fx_obj = spawned_fx.GetComponent <FX_Object>(); fx_obj.vol = vol; fx_obj.mixerGroup = mixer; return(spawned_fx); }
public UnityEngine.GameObject SpawnFX(UnityEngine.GameObject fx, Vector3 position, Vector3 rotation, float vol = -1, Transform parent = null, FXType effectName = FXType.Default) { if (fx == null) { return(null); } if (onesieTracker.ContainsKey(effectName)) { if (onesieTracker[effectName]) { return(null); } } UnityEngine.GameObject spawned_fx = Instantiate(fx, position, Quaternion.identity); if (onesieChecker.ContainsKey(effectName) && onesieChecker[effectName]) { onesieTracker[effectName] = spawned_fx; } if (spawned_fx == null) { return(null); } spawned_fx.transform.parent = (parent != null ? parent : holder.transform); if (rotation != Vector3.zero) { spawned_fx.transform.forward = rotation; } FX_Object fx_obj = spawned_fx.GetComponent <FX_Object>(); fx_obj.vol = vol; fx_obj.mixerGroup = mixer; return(spawned_fx); }