Update AssetSystem

修复了加载多个相同的子场景而无法全部卸载的问题。
pull/28/head
hevinci 2022-07-25 18:31:35 +08:00
parent 045e74c82f
commit 1dc434832a
2 changed files with 5 additions and 4 deletions

View File

@ -70,11 +70,13 @@ namespace YooAsset
// 2. 加载场景
if (Status == EStatus.Loading)
{
_asyncOp = SceneManager.LoadSceneAsync(_sceneName, SceneMode);
// 注意如果场景不存在则返回NULL
_asyncOp = SceneManager.LoadSceneAsync(MainAssetInfo.AssetPath, SceneMode);
if (_asyncOp != null)
{
_asyncOp.allowSceneActivation = true;
_asyncOp.priority = _priority;
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
Status = EStatus.Checking;
}
else
@ -91,7 +93,6 @@ namespace YooAsset
{
if (_asyncOp.isDone)
{
SceneObject = SceneManager.GetSceneByName(_sceneName);
if (SceneObject.IsValid() && _activateOnLoad)
SceneManager.SetActiveScene(SceneObject);

View File

@ -46,6 +46,7 @@ namespace YooAsset
{
_asyncOp.allowSceneActivation = true;
_asyncOp.priority = _priority;
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
Status = EStatus.Checking;
}
else
@ -62,7 +63,6 @@ namespace YooAsset
{
if (_asyncOp.isDone)
{
SceneObject = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
if (SceneObject.IsValid() && _activateOnLoad)
SceneManager.SetActiveScene(SceneObject);