fix invocation and other errors

This commit is contained in:
Mister_Nebula 2021-02-09 10:03:13 +00:00
parent a4184f921c
commit c5d8a25922
3 changed files with 15 additions and 3 deletions

View File

@ -25,6 +25,11 @@ namespace QSB.QuantumSync.Events
public override bool CheckMessage(bool isServer, QuantumAuthorityMessage message)
{
if (!QSBCore.HasWokenUp)
{
return false;
}
var objects = QSBWorldSync.GetWorldObjects<IQSBQuantumObject>();
var obj = objects.ToList()[message.ObjectId];

View File

@ -3,6 +3,7 @@ using QSB.Player;
using QSB.TransformSync;
using QuantumUNET;
using System;
using System.Reflection;
using UnityEngine;
namespace QSB.Utility
@ -51,9 +52,9 @@ namespace QSB.Utility
{
del.DynamicInvoke(args);
}
catch (Exception ex)
catch (TargetInvocationException ex)
{
DebugLog.ToConsole($"Error invoking delegate! Message : {ex.Message} Stack Trace : {Environment.NewLine}{ex.StackTrace}", MessageType.Error);
DebugLog.ToConsole($"Error invoking delegate! Message : {ex.InnerException.Message} Stack Trace : {ex.InnerException.StackTrace}", MessageType.Error);
}
}
}

View File

@ -13,11 +13,17 @@ namespace QSB.Utility
private ComponentState _wasEnabled = ComponentState.NotChecked;
public OnEnableDisableTracker()
=> QSBSceneManager.OnSceneLoaded += (OWScene scene, bool inUniverse) => Destroy(this);
private void OnDestroy()
=> QSBSceneManager.OnSceneLoaded -= (OWScene scene, bool inUniverse) => Destroy(this);
private void Update()
{
if (AttachedComponent == null)
{
DebugLog.ToConsole($"Attached component is null! Attached to {gameObject.name}", OWML.Common.MessageType.Error);
DebugLog.ToConsole($"Attached component is null!", OWML.Common.MessageType.Error);
return;
}
var state = AttachedComponent.isActiveAndEnabled ? ComponentState.Enabled : ComponentState.Disabled;