private static void DestroyCustomObjects()
            {
                while (SpawnedObjects.Count != 0)
                {
                    GameObject gameObject = SpawnedObjects[0];
                    SpawnedObjects.Remove(gameObject);
                    UnityEngine.Object.Destroy(gameObject);
                    foreach (TubeBloomPrePassLight tubeBloomPrePassLight in gameObject.GetComponentsInChildren <TubeBloomPrePassLight>(true))
                    {
                        //Unity requires this to be present, otherwise Unregister won't be called. Memory leaks may occour if this is removed.
                        tubeBloomPrePassLight.InvokeMethod <object, BloomPrePassLight>("UnregisterLight");
                    }
                }

                while (SpawnedComponents.Count != 0)
                {
                    Component component = SpawnedComponents[0];
                    SpawnedComponents.Remove(component);
                    UnityEngine.Object.Destroy(component);
                }
            }
            /// <summary>
            /// Recursively attaches managers to a <see cref="CustomPlatform"/>
            /// </summary>
            /// <param name="go">The current <see cref="GameObject"/>, this parameter acts as a pointer</param>
            /// <param name="root">The root <see cref="GameObject"/> of the <see cref="CustomPlatform"/></param>
            private static void AddManagers(GameObject go, GameObject root)
            {
                // Rotation effect manager
                if (go.GetComponentInChildren <RotationEventEffect>(true) != null || go.GetComponentInChildren <MultiRotationEventEffect>(true) != null)
                {
                    RotationEventEffectManager rotManager = root.GetComponent <RotationEventEffectManager>();
                    if (rotManager == null)
                    {
                        rotManager = root.AddComponent <RotationEventEffectManager>();
                        SpawnedComponents.Add(rotManager);
                        rotManager.CreateEffects(go);
                        rotManager.RegisterForEvents();
                    }
                }

                // Add a trackRing controller if there are track ring descriptors
                if (go.GetComponentInChildren <TrackRings>(true) != null)
                {
                    foreach (TrackRings trackRings in go.GetComponentsInChildren <TrackRings>(true))
                    {
                        GameObject ringPrefab = trackRings.trackLaneRingPrefab;

                        // Add managers to prefabs (nesting)
                        AddManagers(ringPrefab, root);
                    }

                    TrackRingsManagerSpawner trms = root.GetComponent <TrackRingsManagerSpawner>();
                    if (trms == null)
                    {
                        trms = root.AddComponent <TrackRingsManagerSpawner>();
                        SpawnedComponents.Add(trms);
                    }
                    trms.CreateTrackRings(go);
                }

                // Add spectrogram manager
                if (go.GetComponentInChildren <Spectrogram>(true) != null)
                {
                    foreach (Spectrogram spec in go.GetComponentsInChildren <Spectrogram>(true))
                    {
                        GameObject colPrefab = spec.columnPrefab;
                        AddManagers(colPrefab, root);
                    }

                    SpectrogramColumnManager specManager = go.GetComponent <SpectrogramColumnManager>();
                    if (specManager == null)
                    {
                        specManager = go.AddComponent <SpectrogramColumnManager>();
                        SpawnedComponents.Add(specManager);
                    }
                    specManager.CreateColumns(go);
                }

                if (go.GetComponentInChildren <SpectrogramMaterial>(true) != null)
                {
                    // Add spectrogram materials manager
                    SpectrogramMaterialManager specMatManager = go.GetComponent <SpectrogramMaterialManager>();
                    if (specMatManager == null)
                    {
                        specMatManager = go.AddComponent <SpectrogramMaterialManager>();
                        SpawnedComponents.Add(specMatManager);
                    }
                    specMatManager.UpdateMaterials(go);
                }

                if (go.GetComponentInChildren <SpectrogramAnimationState>(true) != null)
                {
                    // Add spectrogram animation state manager
                    SpectrogramAnimationStateManager specAnimManager = go.GetComponent <SpectrogramAnimationStateManager>();
                    if (specAnimManager == null)
                    {
                        specAnimManager = go.AddComponent <SpectrogramAnimationStateManager>();
                        SpawnedComponents.Add(specAnimManager);
                    }
                    specAnimManager.UpdateAnimationStates();
                }

                // Add Song event manager
                if (go.GetComponentInChildren <SongEventHandler>(true) != null)
                {
                    foreach (SongEventHandler handler in go.GetComponentsInChildren <SongEventHandler>())
                    {
                        SongEventManager manager = handler.gameObject.AddComponent <SongEventManager>();
                        SpawnedComponents.Add(manager);
                        manager._songEventHandler = handler;
                    }
                }

                // Add EventManager
                if (go.GetComponentInChildren <EventManager>(true) != null)
                {
                    foreach (EventManager em in go.GetComponentsInChildren <EventManager>())
                    {
                        PlatformEventManager pem = em.gameObject.AddComponent <PlatformEventManager>();
                        SpawnedComponents.Add(pem);
                        pem._EventManager = em;
                    }
                }
            }