Skip to content

Commit cf534bd

Browse files
committed
Update upm README file
1 parent 768d847 commit cf534bd

File tree

1 file changed

+205
-0
lines changed

1 file changed

+205
-0
lines changed

README.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<p align="center"><img src="https://raw.githubusercontent.com/cronyxllc/DeveloperConsole/main/docs/images/Screenshot.PNG"></p>
2+
3+
# DeveloperConsole
4+
5+
[![Release](https://img.shields.io/github/v/release/cronyxllc/DeveloperConsole)](https://github.com/cronyxllc/DeveloperConsole/releases)
6+
[![openupm](https://img.shields.io/npm/v/com.cronyx.console?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.cronyx.console/) [![Release](https://github.com/cronyxllc/DeveloperConsole/actions/workflows/release.yml/badge.svg)](https://github.com/cronyxllc/DeveloperConsole/actions/workflows/release.yml)
7+
8+
A lightweight, in-game developer console for Unity
9+
10+
## Features
11+
12+
<ul>
13+
<li>Easy to use and extendable in-game developer console!</li>
14+
<li>
15+
<p>Quickly add new commands by marking a method with <code>[Command]</code>:</p>
16+
<pre lang="csharp">
17+
[Command("cube")]
18+
public static void CreateCube (Vector3 pos, float scale)
19+
{
20+
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
21+
cube.transform.position = pos;
22+
cube.transform.localScale = Vector3.one * scale;
23+
}
24+
&nbsp;
25+
// $ cube (1 2 3) 2
26+
// Creates a cube at (1, 2, 3) with scale 2.0f
27+
</pre>
28+
</li>
29+
<li>
30+
<p>Parsing support for all basic C# types, <code>IEnumerable&lt;T&gt;</code>, <code>List&lt;T&gt;</code>, <code>Dictionary&lt;TKey, TValue&gt;</code>, and <a href="https://github.com/cronyxllc/DeveloperConsole/wiki/Supported-parameter-types">many more</a>.</p>
31+
</li>
32+
33+
<li>
34+
<p>Fully customizable <code>GetOpt</code> command syntax and automatic help text generation:</p>
35+
36+
<pre lang=csharp>
37+
[Command("showcase", Description = "Showcases the flexibility of the command parser.")]
38+
public static void CustomCommand(
39+
[Positional(Description = "The first positional", Meta = "FOO")] Vector3 posOne,
40+
[Positional(Description = "The second positional", Max = 4, Meta = "BAR", Optional = true)] IEnumerable&lt;string&gt; posTwo,
41+
[Switch('a', LongName = "flag", Description = "A flag")] bool flag,
42+
[Switch('b', LongName = "switch", Description = "A switch", Meta = "STR")] string @switch)
43+
{
44+
// Command implementation
45+
}
46+
47+
// Automatically generated help text:
48+
// $ help showcase
49+
// showcase: Showcases the flexibility of the command parser
50+
//
51+
// usage: showcase FOO [BAR] [-a] [-b STR]
52+
// Format:
53+
// FOO Vector3 (x y z)
54+
// BAR IEnumerable<string> [foo bar ...]
55+
// STR string
56+
//
57+
// Mandatory Parameters:
58+
// FOO The first positional
59+
//
60+
// Optional Parameters:
61+
// BAR The second positional
62+
// Can have at most 4 elements
63+
// -a, --flag A flag
64+
// -b, --switch A switch
65+
</pre>
66+
</li>
67+
68+
<li>
69+
<p>Seamless parsing support for nested generic types, such as <code>List&lt;List&lt;T&gt;&gt;</code>.</p>
70+
</li>
71+
<li>
72+
<p>Define parsers for custom types by extending the <code>ParameterParser</code>.</p>
73+
</li>
74+
<li>
75+
<p>Add custom widgets, images, and media by extending the <code>ConsoleEntry</code> class.</p>
76+
</li>
77+
<li>
78+
<p>Implement custom command line parsing through the <code>IConsoleCommand</code> interface.</p>
79+
<pre lang="csharp">
80+
[Command("cmd")]
81+
public class MyCommand : IConsoleCommand
82+
{
83+
public void Invoke(string data)
84+
{
85+
// Parse command line input passed to this command
86+
}
87+
}
88+
</pre>
89+
</li>
90+
<li>
91+
Access filesystem through built-in commands like <code>ls</code> and <code>pwd</code>.
92+
</li>
93+
<li>
94+
<p>A detailed documentation of all of these features and more over at <a href="https://github.com/cronyxllc/DeveloperConsole/wiki">the wiki</a>!</p>
95+
</li>
96+
</ul>
97+
98+
## Installation
99+
100+
### Prerequisites
101+
102+
1. Unity `2020.2` or greater
103+
2. TextMeshPro package `3.0.1` or greater installed in your project. Comes built-in with Unity `2020.2` or greater.
104+
105+
### Installation Guides
106+
107+
<details>
108+
<summary><b>Via PackageInstaller (drag-and-drop)</b></summary>
109+
110+
1. Download the [installer `.unitypackage`](https://package-installer.glitch.me/v1/installer/OpenUPM/com.cronyx.console?registry=https%3A%2F%2Fpackage.openupm.com) to your machine.
111+
2. Import the `.unitypackage` by dragging and dropping it onto the Unity window or by going to <kbd>Assets > Import Package > Custom Package...</kbd> and selecting the package.
112+
3. Import everything by clicking <kbd>Import</kbd>.
113+
4. Give the installer a moment to add the appropriate OpenUPM registries to your project.
114+
5. You're all set!
115+
116+
<sup><a href="https://github.com/cronyxllc/DeveloperConsole/wiki/Installing-via-OpenUPM">See more information here!</a></sup>
117+
</details>
118+
119+
<details>
120+
<summary><b>Via OpenUPM</b></summary>
121+
122+
Run:
123+
124+
```
125+
~/MyProject $ openupm add com.cronyx.console
126+
```
127+
128+
from within your project directory.
129+
130+
<sup><a href="https://github.com/cronyxllc/DeveloperConsole/wiki/Installing-via-PackageInstaller">See more information here!</a></sup>
131+
</details>
132+
133+
<details>
134+
<summary><b>Via UPM (Tarball)</b></summary>
135+
<ol>
136+
<li>Navigate to <a href="https://github.com/cronyxllc/DeveloperConsole/releases">Releases</a> and choose a release.</li>
137+
<li>Download the DeveloperConsole_v*.tar.gz file for that release.</li>
138+
<li>Open the Package Manager window (<kbd>Window > Package Manager</kbd>), click the ➕, and then click <code>Add package from tarball...</code></li>
139+
<img src="https://raw.githubusercontent.com/cronyxllc/DeveloperConsole/main/docs/images/Install_UPMTarball.PNG" width=300px/>
140+
<li>Select the tarball file you just downloaded, and then click <kbd>Open</kbd>.</li>
141+
<li>You're all set!</li>
142+
</ol>
143+
144+
<sup><a href="https://github.com/cronyxllc/DeveloperConsole/wiki/Installing-via-UPM-(Tarball)">See more information here!</a></sup>
145+
</details>
146+
147+
<details>
148+
<summary><b>Via UPM (Git)</b></summary>
149+
<ol>
150+
<li>Open the Package Manager window (<kbd>Window > Package Manager</kbd>), click the ➕, and then click <code>Add package from git...</code></li>
151+
<img src="https://raw.githubusercontent.com/cronyxllc/DeveloperConsole/main/docs/images/Install_UPMGit_URL.PNG" width=300px/>
152+
<li>Enter <code>https://github.com/cronyxllc/DeveloperConsole.git#upm</code> for the URL when prompted.</li>
153+
<li>Click <kbd>Add</kbd> and wait a moment.</li>
154+
<li>You're all set!</li>
155+
</ol>
156+
157+
<sup><a href="https://github.com/cronyxllc/DeveloperConsole/wiki/Installing-via-UPM-(Git)">See more information here!</a></sup>
158+
</details>
159+
160+
## Getting started
161+
162+
### Using the console
163+
164+
By default, you can open the in-game console by pressing the backquote key (`` ` ``) (or tilde, `~`, on QWERTY keyboards). This will open the console UI and allow you to start entering commands. For your first command, try printing the working directory:
165+
166+
```
167+
~ $ pwd
168+
C:\Users\MyUser\AppData\LocalLow\DefaultCompany\DeveloperConsole
169+
~ $ █
170+
```
171+
172+
Just like in a Bash console, past inputs can be cycled through using the up and down arrow keys. For a list of all commands that can be called, enter `$ help`.
173+
174+
### Customizing the console
175+
176+
To customize the console's settings, go to <kbd>Window > DeveloperConsole > Settings</kbd>. This will create a `ConsoleSettings` asset in your projects directory. Hover over any of the settings to get a description of what that feature does. For a more detailed description of the console's settings, see the [settings documentation](Console-settings).
177+
178+
### Adding commands to the console
179+
180+
The `DeveloperConsole` package was created with the intention that you would extend its functionality by creating console commands specific to your own project. Creating a console command can be as simple as tagging a static method with a `CommandAttribute`:
181+
182+
```csharp
183+
[Command("cmd")]
184+
public static void MyCommand (Vector3 v)
185+
{
186+
// Your command's code
187+
}
188+
```
189+
190+
and calling it like so:
191+
192+
```
193+
~ $ cmd (1 2 3)
194+
~ $ █
195+
```
196+
197+
or as complicated as creating a custom class that manually parses command-line arguments. See the documentation on [console commands](Console-Commands) for more information on creating your own commands.
198+
199+
## Contributing
200+
201+
Please feel free to contribute to this project! If you'd like to contribute, please do any of the following:
202+
203+
* ‼️ Let others know about this project! We'd like to get the word out!
204+
* 🐛 [Open an issue with a bug report or feature request.](https://github.com/cronyxllc/DeveloperConsole/issues/new/choose)
205+
* ➕ Open a pull request with a change or new feature. Please let us know before you start working to prevent development conflicts.

0 commit comments

Comments
 (0)