public static void Unsubscribe(IScriptedPlaybackListener listener) { if (!_scriptListeners.Remove(listener)) { throw new System.InvalidOperationException($"{listener} is not subscribed to this script and can't be removed."); } }
public static void Subscribe(IScriptedPlaybackListener listener) { if (_scriptListeners.Contains(listener)) { throw new System.InvalidOperationException($"{listener} is already subscribed to this script."); } else { _scriptListeners.Add(listener); } listener.SetPlaybackSpeed(_playbackSpeed); }