You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably the most common approach, you get your `IEntityCollectionManager` instance (usually injected in to your class) and you call `CreateObservableGroup`, this will create or return an existing observable group for you which internally contains the `Entities` that match the group for you to query on further. This is often a better approach than accessing entities directly. (read more on this in querying/filtration docs)
This is not used often but is there for convenience, it allows you to just get back an `IEnumerable<IEntity>` collection which contains all entities which match the group, so it you can query on the matching entities further however you want.
Copy file name to clipboardExpand all lines: docs/framework/groups.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,13 +18,13 @@ There are a few different ways to create a group, here are some of the common wa
18
18
19
19
There is a `Group` class which implements `IGroup`, this can be instantiated and passed any of the components you want to target, like so:
20
20
21
-
```c#
21
+
```csharp
22
22
vargroup=newGroup(typeof(SomeComponent));
23
23
```
24
24
25
25
There are also some helper methods here so you can add component types if needed via extension methods, like so:
26
26
27
-
```c#
27
+
```csharp
28
28
vargroup=newGroup()
29
29
.WithComponent<SomeComponent>()
30
30
.WithoutComponent<SomeOtherComponent();
@@ -36,7 +36,7 @@ This is a halfway house between the builder approach and the instantiation appro
36
36
37
37
So there is also a `GroupBuilder` class which can simplify making complex groups, it is easy to use and allows you to express complex group setups in a fluent manner, like so:
38
38
39
-
```c#
39
+
```csharp
40
40
vargroup=newGroupBuilder()
41
41
.WithComponent<SomeComponent>()
42
42
.WithComponent<SomeOtherComponent>()
@@ -49,7 +49,7 @@ So if you are going to be using the same groupings a lot, it would probably make
49
49
50
50
It is quite simple to make your own group, you just need to implement the 2 getters:
Copy file name to clipboardExpand all lines: docs/framework/systems.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ This is a niche system for when you want to carry out some logic outside the sco
16
16
more fine grained control over how you deal with the entities matched.
17
17
18
18
Rather than the `SystemExecutor` doing most of the work for you and managing the subscriptions and entity interactions
19
-
this just provides you the `GroupAccessor` for the entities targetted and its up to you to control how they are
19
+
this just provides you the `GroupAccessor` for the entities targeted and its up to you to control how they are
20
20
dealt with.
21
21
22
22
The `StartSystem` method will be triggered when the system has been added to the executor, and the `StopSystem`
@@ -30,4 +30,4 @@ So by default (with the default implementation of `ISystemExecutor`) systems wil
30
30
2. Implementations of `IReactToEntitySystem`
31
31
3. Other Systems
32
32
33
-
However within those groupings it will load the systems in whatever order Zenject (assuming you are using it) provides them, however there is a way to enforce some level of priority by applying the `[Priority(1)]` attribute, this allows you to specify the priority of how systems should be loaded. The ordering will be from lowest to highest so if you have a priority of 1 it will load before a system with a priority of 10.
33
+
However within those groupings it will load the systems in whatever order Zenject/Extenject (assuming you are using it) provides them, however there is a way to enforce some level of priority by applying the `[Priority(1)]` attribute, this allows you to specify the priority of how systems should be loaded. The ordering will be from lowest to highest so if you have a priority of 1 it will load before a system with a priority of 10.
Then resolve `IEventSystem` in multiple places you will always get back the same instance, which is extremely handy for infrastructure style objects which should act as singletons. If you provide `false` as the value it will return a new instance for every resolve request.
@@ -46,7 +46,7 @@ This will allow you to give the binding a name for resolving via name.
46
46
47
47
This allows you to bind to an actual instance of an object rather than a type, which is useful if you need to manually setup something yourself.
This allows you to lazy bind something to a method rather than an instance/type, which is useful if you want to setup something in a custom way once all DI configuration has been processed.
57
57
58
-
```c#
58
+
```csharp
59
59
varbindingConfiguration=newBindingConfiguration({
60
60
ToMethod:container=>
61
61
{
@@ -85,7 +85,7 @@ The configuration object is simple but can be unsightly for larger configuration
85
85
86
86
There is a builder pattern helper which lets you setup your binding config via a builder rather than an instance of `BindingConfiguration`, this can be used by just creating a lambda within the bind method like so:
There is also another helper which allows you to get an `IObservableGroup` directly from the container, this internally gets the instance of the `IEntityCollectionManager` and requests an observable group of a given type like so:
Copy file name to clipboardExpand all lines: docs/performance/component-type-lookups.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ So if you are happy to provide a type index/id with your call it will bypass the
8
8
9
9
So this change means **YOU** have to tell EcsRx ahead of time what indexes/ids to use for your components and provide that data to the rest of your codebase, its easiest to do this by making a class with static int properties like so:
10
10
11
-
```c#
11
+
```csharp
12
12
publicstaticclassComponentLookupTypes
13
13
{
14
14
publicstaticintNameComponentId=0;
@@ -19,7 +19,7 @@ public static class ComponentLookupTypes
19
19
20
20
Then you can just reference these types anywhere which satisfies the telling of the entity the index, and you then just need to make sure when the application is created it uses these explicit lookups rather than auto generating them, generally done by making your own module and loading it like so:
0 commit comments