public void SaveToFile(string path)
    {
        if (savedData != null)
        {
            return;
        }

        using (var memstream = new MemoryStream())
            using (var fstream = new FileStream(path, FileMode.Create))
                using (var gzipstream = new GZipStream(fstream, CompressionMode.Compress, true)) {
                    var            orderedNodes = data.GetLeaves(pow, width, height).OrderBy(p => (p.pos & 0xFFFF)).ThenBy(p => (p.pos >> 16));
                    QuadtreeLeaves leaves       = new QuadtreeLeaves(orderedNodes.ToArray(), width, height);
                    new BinaryFormatter().Serialize(memstream, leaves);
                    byte[] bytes = memstream.ToArray();

                    gzipstream.Write(bytes, 0, bytes.Length);

                    //Color32[] colors = new Color32[100 * 100];
                    //for (int i = 0; i < colors.Length; i++) {
                    //    colors[i] = new Color32((byte)(UnityEngine.Random.value * 255), (byte)(UnityEngine.Random.value * 255), (byte)(UnityEngine.Random.value * 255), 255);
                    //}

                    //mc = new MyClass(colors, 100, 100);
                    //new BinaryFormatter().Serialize(gzipstream, mc);
                }
    }
    public void SaveToFile(string path)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      stream    = new FileStream(path, FileMode.Create);
        QuadtreeLeaves  leaves    = new QuadtreeLeaves(data.GetLeaves(pow), width, height, pow);

        formatter.Serialize(stream, leaves);
        stream.Close();
    }