public void DeleteBakedDataByIdentifier(BakedDataIdentifier identifier)
        {
            SteamAudioManager steamAudioManager = null;
            IntPtr            probeBox          = IntPtr.Zero;

            try
            {
                steamAudioManager = FindObjectOfType <SteamAudioManager>();
                if (steamAudioManager == null)
                {
                    throw new Exception("Phonon Manager Settings object not found in the scene! Click Window > Phonon");
                }

                steamAudioManager.Initialize(GameEngineStateInitReason.EditingProbes);
                var context = steamAudioManager.GameEngineState().Context();

                byte[] probeBoxData = LoadData();
                PhononCore.iplLoadProbeBox(context, probeBoxData, probeBoxData.Length, ref probeBox);
                PhononCore.iplDeleteBakedDataByIdentifier(probeBox, identifier);
                RemoveLayer(identifier);

                int probeBoxSize = PhononCore.iplSaveProbeBox(probeBox, null);
                probeBoxData = new byte[probeBoxSize];
                PhononCore.iplSaveProbeBox(probeBox, probeBoxData);
                SaveData(probeBoxData);

                steamAudioManager.Destroy();
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }
        }
        public void GenerateProbes()
        {
            ProbePlacementParameters placementParameters;

            placementParameters.placement         = placementStrategy;
            placementParameters.maxNumTriangles   = maxNumTriangles;
            placementParameters.maxOctreeDepth    = maxOctreeDepth;
            placementParameters.horizontalSpacing = horizontalSpacing;
            placementParameters.heightAboveFloor  = heightAboveFloor;

            // Initialize environment
            SteamAudioManager steamAudioManager = null;

            try
            {
                steamAudioManager = FindObjectOfType <SteamAudioManager>();
                if (steamAudioManager == null)
                {
                    throw new Exception("Phonon Manager Settings object not found in the scene! Click Window > Phonon");
                }

                steamAudioManager.Initialize(GameEngineStateInitReason.GeneratingProbes);

                if (steamAudioManager.GameEngineState().Scene().GetScene() == IntPtr.Zero)
                {
                    Debug.LogError("Scene not found. Make sure to pre-export the scene.");
                    steamAudioManager.Destroy();
                    return;
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                return;
            }

            // Create bounding box for the probe.
            IntPtr probeBox = IntPtr.Zero;

            PhononCore.iplCreateProbeBox(steamAudioManager.GameEngineState().Context(), steamAudioManager.GameEngineState().Scene().GetScene(),
                                         Common.ConvertMatrix(gameObject.transform.localToWorldMatrix), placementParameters, null, ref probeBox);

            int numProbes = PhononCore.iplGetProbeSpheres(probeBox, null);

            probeSpherePoints = new float[3 * numProbes];
            probeSphereRadii  = new float[numProbes];

            Sphere[] probeSpheres = new Sphere[numProbes];
            PhononCore.iplGetProbeSpheres(probeBox, probeSpheres);
            for (int i = 0; i < numProbes; ++i)
            {
                probeSpherePoints[3 * i + 0] = probeSpheres[i].centerx;
                probeSpherePoints[3 * i + 1] = probeSpheres[i].centery;
                probeSpherePoints[3 * i + 2] = probeSpheres[i].centerz;
                probeSphereRadii[i]          = probeSpheres[i].radius;
            }

            // Save probe box into searlized data;
            int probeBoxSize = PhononCore.iplSaveProbeBox(probeBox, null);

            probeBoxData = new byte[probeBoxSize];
            PhononCore.iplSaveProbeBox(probeBox, probeBoxData);

            if (steamAudioManager.GameEngineState().Scene().GetScene() != IntPtr.Zero)
            {
                Debug.Log("Generated " + probeSpheres.Length + " probes for game object " + gameObject.name + ".");
            }

            // Cleanup.
            PhononCore.iplDestroyProbeBox(ref probeBox);
            steamAudioManager.Destroy();
            ClearProbeDataMapping();

            // Redraw scene view for probes to show up instantly.
#if UNITY_EDITOR
            UnityEditor.SceneView.RepaintAll();
#endif
        }