Skip to content

Commit 72afc7d

Browse files
Update README.md
1 parent 780e604 commit 72afc7d

File tree

1 file changed

+12
-43
lines changed

1 file changed

+12
-43
lines changed

README.md

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,66 +24,35 @@
2424
1. Clone or download the **O2 Console** repository or download the unity package.
2525
2. Import the O2 Console scripts into your Unity project.
2626
3. **Set up the Console UI**: The project includes a ready-to-use prefab for the console. Simply drag and drop the prefab into your scene to integrate the in-game console with an input field and log display.
27-
2827
4. Optionally, configure a hotkey to toggle the console (e.g., `~` key).
2928

3029
### Usage
3130

3231
To define a console command, simply use the `[ConsoleCommand]` attribute above any static or instance method, as well as public or private properties. The console will automatically register it for in-game use.
3332

33+
Property & Field Example (Public & private)
3434
```csharp
35-
// Method Example
36-
[ConsoleCommand("SomeFunction")]
37-
static void SomeFunction()
38-
{
39-
// Do Something
40-
}
41-
42-
// Property Example (Public)
43-
public class ExampleClass
44-
{
45-
private int _value;
46-
4735
[ConsoleCommand("GetValue")]
48-
public int Value
49-
{
50-
get { return _value; }
51-
set { _value = value; }
52-
}
53-
}
36+
public int Value {get; set;}
5437

55-
// Property Example (Private)
56-
public class ExampleClass
57-
{
58-
private int _privateValue;
38+
[ConsoleCommand("GetStaticValue")]
39+
public static int StaticValue {get; set;}
5940

6041
[ConsoleCommand("GetPrivateValue")]
61-
private int PrivateValue
62-
{
63-
get { return _privateValue; }
64-
}
65-
}
42+
private int PrivateValue;
43+
```````
44+
Instance & Static Method Example
45+
```csharp
6646

67-
// Instance Method Example
68-
public class ExampleInstance
69-
{
7047
[ConsoleCommand("InstanceMethod")]
7148
public void InstanceMethod()
7249
{
7350
// Do Something
7451
}
75-
}
76-
77-
// Static Property Example
78-
public class StaticExample
79-
{
80-
private static int _staticValue;
81-
82-
[ConsoleCommand("GetStaticValue")]
83-
public static int StaticValue
52+
53+
[ConsoleCommand("SomeFunction")]
54+
static string SomeFunction()
8455
{
85-
get { return _staticValue; }
86-
set { _staticValue = value; }
56+
return // Do Something
8757
}
88-
}
8958
```````

0 commit comments

Comments
 (0)