Skip to content

Commit 2f9423d

Browse files
authored
Update README.md
1 parent 62356d6 commit 2f9423d

File tree

1 file changed

+50
-7
lines changed

1 file changed

+50
-7
lines changed

README.md

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
# Command Tool for Unity 2019+
22

33
## Installation
4-
### Option A:
5-
1) Copy this repo's .git URL
6-
2) Open Unity Package Manager
7-
3) Click '+' icon and select 'Install from git URL'
8-
4) Paste URL
9-
5) Hit Enter/Click done
10-
6) Package will install
4+
### Option A (GIT Package):
5+
1) Open Unity Package Manager
6+
2) Click '+' icon and select 'Install from git URL'
7+
3) Paste <code>https://github.com/maxfleetdev/unity-command-tool.git</code> into prompt
8+
4) Hit Enter/Click done
9+
5) Package will begin installing
10+
11+
### Option B (Package):
12+
1) Download commander.unitypackage from latest release page
13+
2) Double click on downloaded file
14+
3) Unity will automatically install inside the open project
15+
16+
## How To Use
17+
### Command Attribute
18+
Commands are assigned by using the <code>Command[...]</code> attribute:
19+
```c#
20+
[Command("give", "Gives player an item using ID and Quantity")]
21+
private void GiveCommand(int id, int quantity)
22+
{
23+
...
24+
```
25+
Attributes have many overloads, so you can provide descriptions, hidden commands, certain role access etc (working on improving with extra attributes)
26+
27+
Commands can be assigned in any class, static or instanced (MonoBehaviour)
28+
- Static Command methods are registered on startup automatically by CommandRegistry
29+
- Instanced Commands methods **must** be registered on creation (Awake/Start etc)
30+
31+
### Static Command Example:
32+
```c#
33+
[Command("give", "Gives player an item using ID and Quantity")]
34+
private static void GiveCommand(int id, int quantity)
35+
{
36+
AddItem(id, quantity);
37+
}
38+
```
39+
40+
### Instance Command Example:
41+
```c#
42+
private void Awake()
43+
{
44+
// Called Only Once
45+
CommandRegistry.RegisterInstanceCommands(this);
46+
}
47+
48+
[Command("give", "Gives player an item using ID and Quantity")]
49+
private static void GiveCommand(int id, int quantity)
50+
{
51+
AddItem(id, quantity);
52+
}
53+
```

0 commit comments

Comments
 (0)