From 45e05b5800a338bc3833dddfeb3f99e115e793d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Sun, 9 Jul 2023 17:33:52 +0800 Subject: [PATCH] fix scene(failed) --- Assets/Scripts/UmaSceneController.cs | 5 +++-- Assets/Scripts/UmaViewerMain.cs | 2 +- Assets/Scripts/umamusume/Gallop/Live/Director.cs | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/UmaSceneController.cs b/Assets/Scripts/UmaSceneController.cs index 2bf12fa..863107b 100644 --- a/Assets/Scripts/UmaSceneController.cs +++ b/Assets/Scripts/UmaSceneController.cs @@ -13,7 +13,7 @@ public class UmaSceneController:MonoBehaviour { if (instance) { - Destroy(this.gameObject); + Destroy(instance.gameObject); } instance = this; DontDestroyOnLoad(this); @@ -26,9 +26,10 @@ public class UmaSceneController:MonoBehaviour IEnumerator LoadLiveSceneAsync(string sceneName, Action OnSceneloaded, Action OnLastSceneUnloaded) { + if (CavansInstance) { - Destroy(CavansInstance); + //Destroy(CavansInstance); } CavansInstance = Instantiate(CavansPrefab, transform); var animation = CavansInstance.GetComponent(); diff --git a/Assets/Scripts/UmaViewerMain.cs b/Assets/Scripts/UmaViewerMain.cs index 8100722..22d5f13 100644 --- a/Assets/Scripts/UmaViewerMain.cs +++ b/Assets/Scripts/UmaViewerMain.cs @@ -148,7 +148,7 @@ public class UmaViewerMain : MonoBehaviour string filePath = asset.FilePath; if (File.Exists(filePath)) { - AssetBundle bundle = AssetBundle.LoadFromFile(filePath); + AssetBundle bundle = UmaViewerBuilder.LoadOrGet(asset); foreach (var item in UmaDatabaseController.Instance.LiveData) { var musicId = Convert.ToInt32(item["music_id"]); diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index 8c94cb2..8b53ba1 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -13,6 +13,7 @@ using System.Data; using System.Runtime.Remoting.Metadata.W3cXsd2001; using CriWare; using static UmaViewerAudio; +using UnityEngine.SceneManagement; namespace Gallop.Live { @@ -504,6 +505,21 @@ namespace Gallop.Live void Update() { + if (Input.GetKeyDown(KeyCode.Escape)) + { + UmaSceneController.instance.LoadScene("Version2", + delegate () + { + AssetBundle.UnloadAllAssetBundles(true); + }, + delegate () + { + + }); + + return; + } + if (_isLiveSetup) { if(_syncTime == false)