Improvements to CS Console

* Errors are now logged properly.
* Can now define classes, methods, etc - no longer has to be an expression body.
* Added `StartCoroutine(IEnumerator routine)` helper method to easily run a Coroutine
* Disabling suggestions now properly stops Explorer trying to update suggestion cache instead of just not showing them. In the rare cases that suggestions cause a crash, disabling them will now prevent those crashes.
* Various other misc improvements behind the scenes
This commit is contained in:
Sinai
2021-03-25 18:39:35 +11:00
parent a9fbea7c96
commit 2107df70ad
11 changed files with 289 additions and 56 deletions

View File

@ -1,5 +1,6 @@
#if MONO
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@ -7,6 +8,7 @@ using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityExplorer.Core;
using UnityExplorer.Core.CSharp;
namespace UnityExplorer.Core.Runtime.Mono
{
@ -25,6 +27,11 @@ namespace UnityExplorer.Core.Runtime.Mono
//SceneManager.activeSceneChanged += ExplorerCore.Instance.OnSceneLoaded2;
}
public override void StartConsoleCoroutine(IEnumerator routine)
{
DummyBehaviour.Instance.StartCoroutine(routine);
}
public override string LayerToName(int layer)
=> LayerMask.LayerToName(layer);
@ -50,4 +57,12 @@ namespace UnityExplorer.Core.Runtime.Mono
}
}
public static class MonoExtensions
{
public static void Clear(this StringBuilder sb)
{
sb.Remove(0, sb.Length);
}
}
#endif