private void SaveAsset()
        {
            RecordAnalytics();
            RenderPreviewTexture();

            GGeneralParams generalParams = GTextureToolParams.Instance.General;

            GUtilities.EnsureDirectoryExists(generalParams.Directory);

            string ext =
                generalParams.Extension == GImageFileExtension.PNG ? "png" :
                generalParams.Extension == GImageFileExtension.JPG ? "jpg" :
                generalParams.Extension == GImageFileExtension.EXR ? "exr" :
                generalParams.Extension == GImageFileExtension.TGA ? "tga" : "file";
            string fileName = string.Format("{0}_{1}.{2}", GCommon.GetTimeTick(), generalParams.Mode.ToString(), ext);
            string filePath = Path.Combine(generalParams.Directory, fileName);

            TextureFormat format = generalParams.UseHighPrecisionTexture ? TextureFormat.RGBAFloat : TextureFormat.RGBA32;
            Texture2D     tex    = new Texture2D(generalParams.Resolution, generalParams.Resolution, format, false);

            tex.wrapMode = TextureWrapMode.Clamp;
            GCommon.CopyFromRT(tex, PreviewRt);

            byte[] data =
                generalParams.Extension == GImageFileExtension.PNG ? tex.EncodeToPNG() :
                generalParams.Extension == GImageFileExtension.JPG ? tex.EncodeToPNG() :
                generalParams.Extension == GImageFileExtension.EXR ? tex.EncodeToPNG() :
                generalParams.Extension == GImageFileExtension.TGA ? tex.EncodeToPNG() : new byte[0];
            File.WriteAllBytes(filePath, data);

            GUtilities.DestroyObject(tex);
            AssetDatabase.Refresh();

            Object o = AssetDatabase.LoadAssetAtPath <Texture2D>(filePath);

            if (o != null)
            {
                EditorGUIUtility.PingObject(o);
                Selection.activeObject = o;
            }
        }