ScriptGlue: Added Log.Exception

- Also pushed missing List Editor fix
This commit is contained in:
Simon Lübeß
2024-01-15 01:21:56 +01:00
parent 49db3a28c8
commit ceb4241216
6 changed files with 96 additions and 29 deletions
+11 -5
View File
@@ -806,21 +806,22 @@ static class ScriptEngine
return scriptClass;
}
internal static void HandleMonoException(MonoException* exception, ScriptInstance sourceInstance = null)
internal static void HandleMonoException(MonoException* exception, UUID entityId)
{
MonoExceptionHelper wrappedException = new MonoExceptionHelper(exception);
String entityInfo = scope .();
if (sourceInstance != null)
if (entityId != .Zero)
{
wrappedException.Instance = sourceInstance.EntityId;
wrappedException.Instance = entityId;
Result<Entity> sourceEntity = Context.GetEntityByID(sourceInstance.EntityId);
Result<Entity> sourceEntity = Context.GetEntityByID(entityId);
if (sourceEntity case .Ok(let e))
{
entityInfo.AppendF($" ({e.Name} | {sourceInstance.EntityId})");
entityInfo.AppendF($" ({e.Name} | {entityId})");
}
}
@@ -829,6 +830,11 @@ static class ScriptEngine
wrappedException.ReleaseRef();
}
internal static void HandleMonoException(MonoException* exception, ScriptInstance sourceInstance = null)
{
HandleMonoException(exception, sourceInstance?.EntityId ?? .Zero);
}
public static void ShowScriptEditor(Entity entity, ScriptComponent* scriptComponent)
{
if (scriptComponent.Instance == null)