static void BakeLevels()
    {
        EnvironmentChange envChange = GameObject.FindObjectOfType <EnvironmentChange> ();

        if (envChange && envChange.levels != null)
        {
            int numLevels = envChange.levels.Length;

            for (int levelIndex = 0; levelIndex < numLevels; ++levelIndex)
            {
                EditorUtility.DisplayProgressBar("Baking Lighting", "Baking " + envChange.levels[levelIndex], (float)levelIndex / (float)numLevels);
                string[] levels = new string[1];
                levels[0] = "Assets/AudioSpaces/Scenes/" + envChange.levels[levelIndex] + ".unity";
                Lightmapping.BakeMultipleScenes(levels);
            }
            EditorUtility.ClearProgressBar();
        }
    }
        public void Read(Stream stream, DbEnvironment env, IFormatToken previous)
        {
            var remainingLength = stream.ReadShort();

            using (var ts = new ReadablePartialStream(stream, remainingLength))
            {
                var changes = new List <EnvironmentChange>();

                while (ts.Position < ts.Length)
                {
                    var change = new EnvironmentChange
                    {
                        Type     = (ChangeType)ts.ReadByte(),
                        NewValue = ts.ReadByteLengthPrefixedString(env.Encoding),
                        OldValue = ts.ReadByteLengthPrefixedString(env.Encoding)
                    };
                    changes.Add(change);
                }
                Changes = changes.ToArray();
            }
        }