public void DestroyAllFx() { Fx fx = null; for (int i = 0; i < FxList.Count; i++) { fx = FxList[i]; for (int j = 0; j < Fx.sMaxScaleInfoCount; j++) { fx.ParticleArray[j] = null; fx.AnimationObjectArray[j] = null; fx.ParticleCount = 0; } fx.RootParticle = null; fx.BindTarget = null; fx.ParentTransform = null; GameObject.Destroy(fx.Instance); fx.Instance = null; fx = null; } FxList.Clear(); }
void OnDestroy() { for (int i = 0; i < FxList.Count; i++) { var obj = FxList[i]; GameObject.Destroy(obj); } FxList.Clear(); }