Skip to content

Commit 77e16a7

Browse files
Updated readme
1 parent 8c914e0 commit 77e16a7

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public class MainController : Controller {
142142
public class MovementComponent : Component<MovementComponent, MovementSystem> { }
143143
```
144144

145-
**Component properties:** Public properties are the heart of your Components, and are here to provide data for the Systems to use. Properties can be added to components like in any other class and can consist of any kind of type.
145+
**Public Properties:** Public properties are the heart of your [Components](#components), and are here to provide data for the [Systems](#systems) to use. Properties can be added to [Components](#components) like in any other class and can consist of any kind of type.
146146

147147
```csharp
148148
public class MovementComponent : Component<MovementComponent, MovementSystem> {
@@ -153,6 +153,22 @@ public class MovementComponent : Component<MovementComponent, MovementSystem> {
153153
}
154154
```
155155

156+
**Editor Protection:** Sometimes you want to hide properties from the Unity Editor when they are, for example are managed by the [Systems](#systems). By flagging these properties with the Protected attribute, it will no longer shows up in the Unity Editor, but is still accessible by the [Systems](#systems).
157+
158+
```csharp
159+
public class MovementComponent : Component<MovementComponent, MovementSystem> {
160+
[Protected] public float currentSpeed;
161+
}
162+
```
163+
164+
<!-- **Editor Reference:**
165+
166+
```csharp
167+
public class MovementComponent : Component<MovementComponent, MovementSystem> {
168+
[Referenced] public BoxCollider playerCollider;
169+
}
170+
``` -->
171+
156172
_This section of the documentation is in process!_
157173

158174
### Systems
@@ -163,6 +179,25 @@ _This section of the documentation is in process!_
163179
public class MovementSystem : System<MovementSystem, MovementComponent> { }
164180
```
165181

182+
**Injection:** The [System](#systems) allows the use of the Injected attribute on properties to automatically assign the values of referenced [Systems](#Systems), [Services](#Services) and [Controllers](#controllers), making all public methods and properties accessible. These properties are assigned during the OnInitialize cycle and are available for use at the OnInitialized cycle.
183+
184+
```csharp
185+
public class MovementSystem : System<MovementSystem, MovementComponent> {
186+
[Injected] private MainController mainController;
187+
[Injected] private HealthSystem healthSystem;
188+
[Injected] private AudioService audioService;
189+
}
190+
```
191+
192+
**Assets:** The [System](#system) allows the use of the Asset attribute on properties to automatically assign the values of referenced Assets. Assets can be assigned on the [Controller](#controllers) instance in your Scene. When assigning using the empty contructor, the property's name will be used for searching the Asset, to find an Asset by it's name, use the string overload. All types of UnityEngine's Object can be used in these fields. These properties are assigned during the OnInitialize cycle and are available for use at the OnInitialized cycle. When an asset is not found, an error is thrown.
193+
194+
```csharp
195+
public class MovementSystem : System<MovementSystem, MovementComponent> {
196+
[Asset] private GameObject playerPrefab;
197+
[Asset ("ShopDialog")] private NpcDialog npcDialog;
198+
}
199+
```
200+
166201
_This section of the documentation is in process!_
167202

168203
### Services
@@ -173,4 +208,23 @@ _This section of the documentation is in process!_
173208
public class AudioService : Service<AudioService> { }
174209
```
175210

211+
**Injection:** The [Service](#services) allows the use of the Injected attribute on properties to automatically assign the values of referenced [Systems](#Systems), [Services](#Services) and [Controllers](#controllers), making all public methods and properties accessible. These properties are assigned during the OnInitialize cycle and are available for use at the OnInitialized cycle.
212+
213+
```csharp
214+
public class AudioService : Service<AudioService> {
215+
[Injected] private MainController mainController;
216+
[Injected] private MovementSystem movementSystem;
217+
[Injected] private NetworkService networkService;
218+
}
219+
```
220+
221+
**Assets:** The [Service](#services) allows the use of the Asset attribute on properties to automatically assign the values of referenced Assets. Assets can be assigned on the [Controller](#controllers) instance in your Scene. When assigning using the empty contructor, the property's name will be used for searching the Asset, to find an Asset by it's name, use the string overload. All types of UnityEngine's Object can be used in these fields. These properties are assigned during the OnInitialize cycle and are available for use at the OnInitialized cycle. When an asset is not found, an error is thrown.
222+
223+
```csharp
224+
public class AudioService : Service<AudioService> {
225+
[Asset] private GameObject playerPrefab;
226+
[Asset ("ShopDialog")] private NpcDialog npcDialog;
227+
}
228+
```
229+
176230
_This section of the documentation is in process!_

0 commit comments

Comments
 (0)