Giter Site home page Giter Site logo

tilde's Introduction

A remote developer console for Unity


⚑ Quickstart

  1. In the package manager, select "Add package from git URL..." and add tilde using the url https://github.com/grahamboree/tilde
  2. Add the Prefabs/Tilde prefab to your scene.
  3. Add either the Prefabs/Drawer Console or Prefabs/Windowed Console prefab to your scene.
  4. Start the game and press the tilde/backtick key to open the console.
  5. Run help to list available commands.
  6. Open localhost:55055 in a web browser to access the remote console.

πŸ“Έ Screenshots

Drawer console prefab Windowed console prefab

✨ Features

  • Two styles of console prefabs: window (similar to popular MOBAs) and drawer (similar to classic FPS's).
  • Remotely execute commands with a web-based console served by an embedded web server.
  • Automatic command registration via function annotation.
  • Automatic command history. Cycle through previous commands with the up and down arrow keys.
  • Tab autocomplete.
  • Auto-generated command names, or specify them explicitly.
  • Displays all Unity log, warning, error and exception messages colored as you'd expect.
  • Bind keys to run commands with the bind and unbind commands.
  • Supports commands with any number of arguments.
  • help commmand and basic commmand documentation system.

πŸ“² Remote Console

Tilde also provides an embedded web server and web-based console for executing commands remotely. The default port is 55055, but it can be specified in the Tilde Web Console Server component. This enables you to remotely execute commands on mobile devices or consoles where bringing up a keyboard and typing a command is difficult.

❗️It's highly recommended that you disable the remote console in shipping versions of your game. To do so, simply remove the Tilde Web Console Server component.

πŸ— Adding Commands

Console commands are public, static functions annotated with [ConsoleCommand]. Annotated command functions optionally take an array of strings containing the arguments to that command, and also can optionally return a string to be printed to the console as output.

// Takes no arguments, no output
[ConsoleCommand] public static void Command1() { ... }

// Takes no arguments, prints some output
[ConsoleCommand] public static string Command2() { ... }

// Can take some arguments, no output
[ConsoleCommand] public static void Command3(string[] args) { ... }

// Can take some arguments, prints some output
[ConsoleCommand] public static string Command4(string[] args) { ... }

Command Name

The name of a console command is generated from the annotated function's name. You can override this by specifying the name argument to the ConsoleCommand attribute.

// Registers the command "damageThePlayer"
[ConsoleCommand()]
public static void damageThePlayer(string[] args) { ... }

// Registeres the command "heal"
[ConsoleCommand(name: "heal")]
public static void HealThePlayer(string[] args) { ... }

Doc String

Console commands can also have a documentation (doc) string associated with them to provide a brief explination of what the command does and how to use it. To add a doc string to a command, specify the docs argument to the ConsoleCommand attribute.

[ConsoleCommand(name: "heal", docs: "heal the player by the specified amount")]
public static void HealThePlayer(string[] args) { ... }

The help command shows all the registered commands along with the first line of their doc strings. help <command> shows the full command doc string for a specific command.

Arguments

Commands can optionally consume any number of positional arguments. Arguments are split by whitespace and passed as an array of strings to the command function. The command then processes each argument string as it sees fit.

tilde's People

Contributors

grahamboree avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.