FairyGUI.NGraphics.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            if (mesh != null)
            {
                if (Application.isPlaying)
                    Mesh.Destroy(mesh);
                else
                    Mesh.DestroyImmediate(mesh);
                mesh = null;
            }
            if (_manager != null)
            {
                _manager.Release();
                _manager = null;
            }
            if (_customMatarial && _material != null)
            {
                if (Application.isPlaying)
                    Material.Destroy(_material);
                else
                    Material.DestroyImmediate(_material);
            }
            _material = null;
            meshRenderer = null;
            meshFilter = null;
            _stencilEraser = null;
            meshModifier = null;
        }

Usage Example

 static public int Dispose(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }