add fatal error messages for missing files

This commit is contained in:
Mister_Nebula 2022-06-30 16:50:23 +01:00
parent 13537f0ec0
commit 7a704edfeb
2 changed files with 13 additions and 0 deletions

View File

@ -127,6 +127,12 @@ public class QSBCore : ModBehaviour
ConversationAssetBundle = Helper.Assets.LoadBundle("AssetBundles/qsb_conversation");
DebugAssetBundle = Helper.Assets.LoadBundle("AssetBundles/qsb_debug");
if (NetworkAssetBundle == null || ConversationAssetBundle == null || DebugAssetBundle == null)
{
DebugLog.ToConsole($"FATAL - An assetbundle is missing! Re-install mod or contact devs.", MessageType.Fatal);
return;
}
QSBPatchManager.Init();
DeterministicManager.Init();
QSBLocalization.Init();

View File

@ -186,6 +186,13 @@ public class QSBNetworkManager : NetworkManager, IAddComponentOnStart
private static GameObject MakeNewNetworkObject(int assetId, string name, Type networkBehaviourType)
{
var bundle = QSBCore.Helper.Assets.LoadBundle("AssetBundles/qsb_empty");
if (bundle == null)
{
DebugLog.ToConsole($"FATAL - An assetbundle is missing! Re-install mod or contact devs.", MessageType.Fatal);
return null;
}
var template = bundle.LoadAsset<GameObject>("Assets/Prefabs/Empty.prefab");
bundle.Unload(false);