game init

This commit is contained in:
2025-11-07 01:59:46 -08:00
parent a58defe364
commit 07f7eb1e2c
333 changed files with 88805 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
public class asyncLoad : MonoBehaviour
{
public float timer = 3;
public bool go;
public bool go1;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
StartCoroutine(LoadScene());
}
private void Update()
{
if (go)
{
timer -= Time.deltaTime;
if (timer <= 0) go1 = true;
}
}
IEnumerator LoadScene()
{
AsyncOperation loadScene = SceneManager.LoadSceneAsync(1);
loadScene.allowSceneActivation = false;
while (!loadScene.isDone)
{
if (loadScene.progress >= 0.9f)
{
go = true;
if (go1) loadScene.allowSceneActivation=true;
}
yield return null;
}
}
}