Exemple #1
0
        private void OnDisable()
        {
            if (this._rateManager == null)
            {
                return;
            }

            this._rateManager.UpdateRateModeChanged -= this.OnUpdateRateModeChanged;

            this._toggleModeTargetFrameRate.onValueChanged.RemoveListener(this.OnToggleModeTargetFrameRateValueChanged);
            this._toggleModeVSyncCount.onValueChanged.RemoveListener(this.OnToggleModeVSyncCountValueChanged);

            this._rateManager.UpdateRateChanged       -= this.OnUpdateRateChanged;
            this._rateManager.TargetUpdateRateChanged -= this.OnTargetUpdateRateChanged;

            this._rateManager.FixedUpdateRateChanged       -= this.OnFixedUpdateRateChanged;
            this._rateManager.TargetFixedUpdateRateChanged -= this.OnTargetFixedUpdateRateChanged;

            this._rateManager.RenderIntervalChanged       -= this.OnRenderIntervalChanged;
            this._rateManager.TargetRenderIntervalChanged -= this.OnTargetRenderIntervalChanged;

            this._sliderUpdateRate.onValueChanged.RemoveListener(this.OnSliderUpdateRateChanged);
            this._sliderFixedUpdateRate.onValueChanged.RemoveListener(this.OnSliderFixedUpdateRateChanged);
            this._sliderRenderInterval.onValueChanged.RemoveListener(this.OnSliderRenderIntervalChanged);

            this._updateRateRequest?.Dispose();
            this._updateRateRequest = null;

            this._fixedUpdateRateRequest?.Dispose();
            this._fixedUpdateRateRequest = null;

            this._renderIntervalRequest?.Dispose();
            this._renderIntervalRequest = null;
        }
Exemple #2
0
 private void OnSliderRenderIntervalChanged(float value)
 {
     if (this._rateManager == null)
     {
         return;
     }
     this._renderIntervalRequest?.Dispose();
     this._renderIntervalRequest = this._rateManager.RequestRenderInterval(Mathf.RoundToInt(value));
 }