wip : shader prewarm & fps control
This commit is contained in:
@@ -91,6 +91,9 @@ namespace OctoCore
|
||||
{
|
||||
module.Init(Settings);
|
||||
}
|
||||
|
||||
QualitySettings.vSyncCount = Settings.Application.VSyncCount;
|
||||
Application.targetFrameRate = Settings.Application.TargetFrameRate;
|
||||
}
|
||||
|
||||
void RegisterModule(IOctoModule module)
|
||||
|
||||
@@ -262,6 +262,18 @@ namespace OctoCore
|
||||
public FadeTransitionSettings FadeSettings = new FadeTransitionSettings();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ApplicationSettings
|
||||
{
|
||||
[Tooltip("Target frame rate (-1 = unlimited)")]
|
||||
public int TargetFrameRate = 120;
|
||||
|
||||
[Tooltip("0 = no vsync, 1 = every vblank, 2 = every second vblank")]
|
||||
public int VSyncCount = 0;
|
||||
}
|
||||
|
||||
public ApplicationSettings Application;
|
||||
|
||||
/// <summary>
|
||||
/// Save system settings.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections;
|
||||
using OctoCore.Navigation.Data;
|
||||
using OctoCore.UI;
|
||||
using UnityEngine;
|
||||
@@ -20,10 +21,14 @@ namespace OctoCore.Navigation
|
||||
[Header("UI Settings")]
|
||||
[SerializeField, Tooltip("Optional panel to show/hide (options, credits...)")]
|
||||
private GameObject _optionalPanel;
|
||||
[SerializeField] private GameObject _loadingScreen;
|
||||
[SerializeField] private GameObject _loadingWheel;
|
||||
|
||||
[SerializeField] private Button _optionalPanelFirstButton;
|
||||
[SerializeField] private Button _mainPanelDefaultButton;
|
||||
|
||||
private bool _isLoading = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// Hide optional panel on start if assigned
|
||||
@@ -35,6 +40,12 @@ namespace OctoCore.Navigation
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_isLoading && _loadingWheel)
|
||||
_loadingWheel.transform.Rotate(0, 0, -200f * Time.deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the first scene. Called by the Play button.
|
||||
/// </summary>
|
||||
@@ -52,6 +63,21 @@ namespace OctoCore.Navigation
|
||||
return;
|
||||
}
|
||||
|
||||
_ = PlayRoutine();
|
||||
}
|
||||
|
||||
private async Awaitable PlayRoutine()
|
||||
{
|
||||
_isLoading = true;
|
||||
|
||||
if (_loadingScreen) _loadingScreen.SetActive(true);
|
||||
|
||||
await System.Threading.Tasks.Task.Delay(5000);
|
||||
#if !UNITY_EDITOR
|
||||
Shader.WarmupAllShaders();
|
||||
#endif
|
||||
|
||||
_isLoading = false;
|
||||
OctoCore.Instance.Navigation.LoadScene(_firstSceneData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user