Пример #1
0
        /// <summary>
        /// De-constructor.
        /// </summary>
        protected virtual void OnDestroy()
        {
            totalTrailsCount--;
            if (totalTrailsCount == 0)
            {
                if (generatedMeshes != null && generatedMeshes.Count > 0)
                {
                    foreach (Mesh m in generatedMeshes)
                    {
#if UNITY_EDITOR
                        DestroyImmediate(m, true);
#else
                        Destroy(m);
#endif
                    }
                }
                generatedMeshes = null;
                mat2Trail.Clear();
                mat2Trail = null;
            }

            if (activeTrail != null)
            {
                activeTrail.Dispose();
                activeTrail = null;
            }

            if (fadingTrails != null)
            {
                foreach (TrailGraphics fadingTrail in fadingTrails)
                {
                    if (fadingTrail != null)
                    {
                        fadingTrail.Dispose();
                    }
                }
                fadingTrails.Clear();
            }
        }
Пример #2
0
        /// <summary>
        /// De-constructor.
        /// </summary>
        protected virtual void OnDestroy()
        {
            totalTrailsCount--;

            if (activeTrail != null)
            {
                activeTrail.Dispose();
                activeTrail = null;
            }

            if (fadingTrails != null)
            {
                foreach (TrailGraphics fadingTrail in fadingTrails)
                {
                    if (fadingTrail != null)
                    {
                        fadingTrail.Dispose();
                    }
                }
                fadingTrails.Clear();
            }
        }