wip : shader prewarm & fps control

This commit is contained in:
Ferlat Thibaud
2026-06-10 15:30:01 +02:00
parent c33d9df20e
commit 0e304de741
15 changed files with 866 additions and 336 deletions
@@ -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);
}