void Awake() { if (cm == null) { DontDestroyOnLoad(gameObject); cm = this; } else if (cm != this) { Destroy(gameObject); } }
/// <summary> /// Creates the character monitor. /// </summary> /// <param name="character">The character.</param> /// <param name="tabPage">The tab page.</param> private static void CreateCharacterMonitor(Character character, Control tabPage) { CharacterMonitor tempMonitor = null; try { tempMonitor = new CharacterMonitor(character); tempMonitor.Parent = tabPage; tempMonitor.Dock = DockStyle.Fill; CharacterMonitor monitor = tempMonitor; tempMonitor = null; tabPage.Controls.Add(monitor); } finally { tempMonitor?.Dispose(); } }