All Projects → stillwwater → Command_terminal

stillwwater / Command_terminal

Licence: mit
Unity Command Terminal: In-Game Console

Labels

Projects that are alternatives of or similar to Command terminal

Liquidsimulator
Cellular Automaton 2D Liquid Simulator for Unity
Stars: ✭ 302 (-5.62%)
Mutual labels:  unity
Handui
UI elements and prototyping tools for hands
Stars: ✭ 313 (-2.19%)
Mutual labels:  unity
Messagepack Csharp
Extremely Fast MessagePack Serializer for C#(.NET, .NET Core, Unity, Xamarin). / msgpack.org[C#]
Stars: ✭ 3,668 (+1046.25%)
Mutual labels:  unity
Configurableshaders
Showing off the power of shader properties in Unity
Stars: ✭ 304 (-5%)
Mutual labels:  unity
Melonloader
The World's First Universal Mod Loader for Unity Games that is Compatible with both Il2Cpp and Mono
Stars: ✭ 306 (-4.37%)
Mutual labels:  unity
Unityandroidil2cpppatchdemo
这是Unity Android APP il2cpp热更完美解决方案的Demo。更新build_demo_apk里的Unity路径,执行即可一键重build Patch和apk。因为文件libunity是没有热更的,如unity版本有变化则热更不适用。
Stars: ✭ 312 (-2.5%)
Mutual labels:  unity
Unity Serializabledictionary
Serializable dictionary class for Unity
Stars: ✭ 302 (-5.62%)
Mutual labels:  unity
Facemoji
😆 A voice chatbot that can imitate your expression. OpenCV+Dlib+Live2D+Moments Recorder+Turing Robot+Iflytek IAT+Iflytek TTS
Stars: ✭ 320 (+0%)
Mutual labels:  unity
Unity Ui Rounded Corners
This components and shaders allows you to add rounded corners to UI elements!
Stars: ✭ 307 (-4.06%)
Mutual labels:  unity
Moon
A cross-platform,lightweight,scalable game server framework written in C++, and support Lua Script
Stars: ✭ 313 (-2.19%)
Mutual labels:  unity
Gltfutility
Simple GLTF importer for Unity
Stars: ✭ 305 (-4.69%)
Mutual labels:  unity
Mapssdk Unity
This repository contains samples, documentation, and supporting scripts for Maps SDK, a Microsoft Garage project.
Stars: ✭ 307 (-4.06%)
Mutual labels:  unity
Gpu Particles
A GPU Particle System for Unity
Stars: ✭ 313 (-2.19%)
Mutual labels:  unity
Standardgeometryshader
An example of a geometry shader with Unity's standard lighting model support.
Stars: ✭ 303 (-5.31%)
Mutual labels:  unity
Dotsui
Unity engine DOTS UI solution
Stars: ✭ 319 (-0.31%)
Mutual labels:  unity
Knight
Knight is a game framework based on Unity3D engine. It includes a complete assetbundle manager, a c# hotfix module based on ILRuntime, and a UI module based on MVVM, and other basic functions support.
Stars: ✭ 302 (-5.62%)
Mutual labels:  unity
Spheredissolve
Customizable procedural spherical dissolve shader for Unity3D, for all your customizable procedural spherical dissolve needs!
Stars: ✭ 311 (-2.81%)
Mutual labels:  unity
Unitygraphicsprogramming
書籍「UnityGraphicsProgramming vol.1」のサンプルコードリポジトリ
Stars: ✭ 321 (+0.31%)
Mutual labels:  unity
Raindropeffect
RainDropEffect for the Unity Asset Store
Stars: ✭ 320 (+0%)
Mutual labels:  unity
Unity Mulligan Renamer
Mulligan Renamer tool for the Unity Editor allows for quick and safe renaming of many assets and gameobjects at once
Stars: ✭ 315 (-1.56%)
Mutual labels:  unity

Unity Command Terminal

A simple and highly performant in-game drop down Console.

gif

Command Terminal is based on an implementation by Jonathan Blow done in the Jai programming language.

Usage

Copy the contents from CommandTerminal to your Assets folder. Attach a Terminal Component to a game object. The console window can be toggled with a hotkey (default is backtick), and another hotkey can be used to toggle the full size window (default is shift+backtick).

Enter help in the console to view all available commands, use the up and down arrow keys to traverse the command history, and the tab key to autocomplete commands.

Registering Commands

There are 3 options to register commands to be used in the Command Terminal.

1. Using the RegisterCommand attribute:

The command method must be static (public or non-public).

[RegisterCommand(Help = "Adds 2 numbers", MinArgCount = 2, MaxArgCount = 2)]
static void CommandAdd(CommandArg[] args) {
    int a = args[0].Int;
    int b = args[1].Int;

    if (Terminal.IssuedError) return; // Error will be handled by Terminal

    int result = a + b;
    Terminal.Log("{0} + {1} = {2}", a, b, result);
}

MinArgCount and MaxArgCount allows the Command Interpreter to issue an error if arguments have been passed incorrectly, this way you can index the CommandArg array, knowing the array will have the correct size.

In this case the command name (add) will be inferred from the method name, you can override this by setting Name in RegisterCommand.

[RegisterCommand(Name = "MyAdd", Help = "Adds 2 numbers", MinArgCount = 2, MaxArgCount = 2)]

2. Using a FrontCommand method:

Here you still use the RegisterCommand attribute, but the arguments are handled in a separate method, prefixed with FrontCommand. This way, MaxArgCount and MinArgCount are automatically inferred.

This also allows you to keep the argument handling FrontCommand methods in another file, or even generate them procedurally during a pre-build.

[RegisterCommand(Help = "Adds 2 numbers")]
static void CommandAdd(int a, int b) {
    int result = a + b;
    Terminal.Log("{0} + {1} = {2}", a, b, result);
}

static void FrontCommandAdd(CommandArg[] args) {
    int a = args[0].Int;
    int b = args[1].Int;

    if (Terminal.IssuedError) return;

    CommandAdd(a, b);
}

3. Manually adding Commands:

RegisterCommand only works for static methods. If you want to use a non-static method, you may add the command manually.

Terminal.Shell.AddCommand("add", CommandAdd, 2, 2, "Adds 2 numbers");
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].