Merge pull request #85 from Vorik-S/main

加载热更新程序集的崩溃bug修正
This commit is contained in:
ALEXTANG
2024-07-11 12:23:12 +08:00
committed by GitHub
3 changed files with 27 additions and 16 deletions

View File

@@ -35,9 +35,12 @@ namespace GameBase
}
protected virtual void OnDestroy()
{
if (this == _instance)
{
Release();
}
}
/// <summary>
/// 判断对象是否有效
@@ -96,7 +99,7 @@ namespace GameBase
}
}
if(_instance == null)
if (_instance == null)
{
Log.Error($"Can't create SingletonBehaviour<{typeof(T)}>");
}

View File

@@ -3,7 +3,7 @@ using GameLogic;
using TEngine;
using UnityEngine;
public partial class GameApp
public partial class GameApp : Singleton<GameApp>
{
private List<ILogicSys> _listLogicMgr;

View File

@@ -9,6 +9,7 @@ using UnityEngine;
using TEngine;
using System.Reflection;
using YooAsset;
using Cysharp.Threading.Tasks;
namespace GameMain
{
@@ -38,6 +39,12 @@ namespace GameMain
base.OnEnter(procedureOwner);
Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter");
m_procedureOwner = procedureOwner;
LoadAssembly().Forget();
}
private async UniTaskVoid LoadAssembly()
{
m_LoadAssemblyComplete = false;
m_HotfixAssemblys = new List<Assembly>();
@@ -78,7 +85,8 @@ namespace GameMain
Log.Debug($"LoadAsset: [ {assetLocation} ]");
m_LoadAssetCount++;
GameModule.Resource.LoadAsset<TextAsset>(assetLocation,LoadAssetSuccess);
var result = await GameModule.Resource.LoadAssetAsync<TextAsset>(assetLocation);
LoadAssetSuccess(result);
}
m_LoadAssemblyWait = true;
@@ -235,7 +243,7 @@ namespace GameMain
Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]");
m_LoadMetadataAssetCount++;
GameModule.Resource.LoadAsset<TextAsset>(assetLocation,LoadMetadataAssetSuccess);
GameModule.Resource.LoadAsset<TextAsset>(assetLocation, LoadMetadataAssetSuccess);
}
m_LoadMetadataAssemblyWait = true;
}