在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Elringus/UnityConsole开源软件地址:https://github.com/Elringus/UnityConsole开源编程语言:C# 99.3%开源软件介绍:InstallationUse UPM to install the package via the following Git URL: Minimum supported Unity version: 2019.1 DescriptionAllows executing static C# methods via an on-demand console IMGUI. How to UseRegister commands by adding [UnityConsole.ConsoleCommand("hello")]
public static void PrintHelloWorld () => Debug.Log("Hello World!");
[UnityConsole.ConsoleCommand]
public static void Add (int arg1, int arg2) => Debug.Log(arg1 + arg2); Enable the console at runtime with: UnityConsole.ConsoleGUI.Initialize() Toggle console GUI with In the console, type either method name or alias of a registered command and press Use To disable the console at runtime: UnityConsole.ConsoleGUI.Destroy() PreprocessorsIt's possible to inject delegates to modify the console input before it's send for execution, eg: using UnityConsole;
using UnityEngine;
public class TestPreprocessor : MonoBehaviour
{
private void OnEnable ()
{
InputPreprocessor.AddPreprocessor(PreprocessInput);
}
private void OnDisable ()
{
InputPreprocessor.RemovePreprocessor(PreprocessInput);
}
private string PreprocessInput (string input)
{
if (input != null && input.StartsWith("@"))
{
Debug.Log(input);
return null;
}
return input;
}
} — will intercept commands starting with |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论