From 7735b716401f630697d5b02910d50dbf8f3416af Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Sat, 30 May 2026 19:35:16 +0800 Subject: 正在编写动态场景加载 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Boot.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Assets/Scripts/Boot.cs (limited to 'Assets/Scripts/Boot.cs') diff --git a/Assets/Scripts/Boot.cs b/Assets/Scripts/Boot.cs new file mode 100644 index 0000000..ddefd0b --- /dev/null +++ b/Assets/Scripts/Boot.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; +#if UNITY_EDITOR +using UnityEditor; +#endif + +public class SceneLoader : MonoBehaviour +{ + [SerializeField] private List scenes; + + private void Awake() + { + foreach (var sceneAsset in scenes) + { + string sceneName = sceneAsset.name; + if (!SceneManager.GetSceneByName(sceneName).isLoaded) + { + SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); + } + } + } +} \ No newline at end of file -- cgit