public override void OnCreated(ILoading loading) { base.OnCreated(loading); if (!Directory.Exists(UserRadioCollection.GameDirUserCollectionDirectory)) { try { Directory.CreateDirectory(UserRadioCollection.GameDirUserCollectionDirectory); } catch (Exception e) { Debug.LogError("Could not create CSLMusicMod_Music directory: " + e); } } if (UserRadioContainer == null) { UserRadioContainer = new GameObject("CSLMusicMod_Definitions").AddComponent <UserRadioCollection>(); } if (StationContainer == null) { StationContainer = new GameObject("CSLMusicMod_Stations").AddComponent <ChannelInitializer>(); } if (ContentContainer == null) { ContentContainer = new GameObject("CSLMusicMod_Content").AddComponent <ContentInitializer>(); } if (MethodDetours == null) { MethodDetours = new GameObject("CSLMusicMod_Detours").AddComponent <Detours>(); } }
public override void OnReleased() { base.OnReleased(); if (UI != null) { UnityEngine.Object.Destroy(UI.gameObject); UI = null; } if (UIShortcutHandler != null) { UnityEngine.Object.Destroy(UI.gameObject); UIShortcutHandler = null; } if (StationContainer != null) { UnityEngine.Object.Destroy(StationContainer.gameObject); StationContainer = null; } if (ContentContainer != null) { UnityEngine.Object.Destroy(ContentContainer.gameObject); ContentContainer = null; } if (MethodDetours != null) { UnityEngine.Object.Destroy(MethodDetours.gameObject); MethodDetours = null; } if (UserRadioContainer != null) { UnityEngine.Object.Destroy(UserRadioContainer.gameObject); UserRadioContainer = null; } if (DisabledContentContainer != null) { UnityEngine.Object.Destroy(DisabledContentContainer.gameObject); UserRadioContainer = null; } }