mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Log Exceptions in thrown by Script OnUpdate-Function
This commit is contained in:
@@ -199,9 +199,18 @@ class ScriptClass : SharpClass
|
|||||||
|
|
||||||
public void OnUpdate(MonoObject* instance, float deltaTime)
|
public void OnUpdate(MonoObject* instance, float deltaTime)
|
||||||
{
|
{
|
||||||
MonoException* exception;
|
MonoException* exception = null;
|
||||||
if (_onUpdate != null)
|
if (_onUpdate != null)
|
||||||
_onUpdate(instance, deltaTime, &exception);
|
_onUpdate(instance, deltaTime, &exception);
|
||||||
|
|
||||||
|
if (exception != null)
|
||||||
|
{
|
||||||
|
char8* str = Mono.mono_string_to_utf8(exception.Message);
|
||||||
|
|
||||||
|
Log.EngineLogger.Error($"Exception in \"{_fullName}.OnUpdate\". Message:\"{StringView(str)}\"");
|
||||||
|
|
||||||
|
Mono.mono_free(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDestroy(MonoObject* instance)
|
public void OnDestroy(MonoObject* instance)
|
||||||
|
|||||||
@@ -226,7 +226,13 @@ struct MonoObject;
|
|||||||
|
|
||||||
struct MonoMethod;
|
struct MonoMethod;
|
||||||
|
|
||||||
struct MonoException;
|
struct MonoException
|
||||||
|
{
|
||||||
|
void* _bla;
|
||||||
|
void* _bla2;
|
||||||
|
void* _bla3;
|
||||||
|
public MonoString* Message;
|
||||||
|
}
|
||||||
|
|
||||||
struct MonoClassField;
|
struct MonoClassField;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user