Skip to content

Commit a6b5ca0

Browse files
author
gamecode-ci
committed
Release 10
1 parent 59d6f90 commit a6b5ca0

38 files changed

+250
-194
lines changed

Documentation/content/cheatsheet.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Here is a quick reference of the most useful classes, interfaces, structs, and a
1111
| Unity.Collections | [NativeHashMap](../../Samples/Packages/com.unity.collections/Unity.Collections/NativeHashMap.cs) | Unsafe Struct |
1212
| Unity.Collections | [NativeList](../../Samples/Packages/com.unity.collections/Unity.Collections/NativeList.cs) | Unsafe Struct |
1313
| Unity.Collections | [NativeQueue](../../Samples/Packages/com.unity.collections/Unity.Collections/NativeQueue.cs) | Unsafe Struct |
14+
| Unity.Entities | [Chunk](../../Samples/Packages/com.unity.entities/Unity.Entities/ArchetypeManager.cs) | Unsafe Struct |
1415
| Unity.Entities | [ComponentDataArray](../../Samples/Packages/com.unity.entities/Unity.Entities/Iterators/ComponentDataArray.cs) | Unsafe Struct |
1516
| Unity.Entities | [ComponentDataFromEntity](../../Samples/Packages/com.unity.entities/Unity.Entities/Iterators/ComponentDataFromEntity.cs) | Unsafe Struct |
1617
| Unity.Entities | [ComponentGroup](../../Samples/Packages/com.unity.entities/Unity.Entities/Iterators/ComponentGroup.cs) | Unsafe Class |
1718
| Unity.Entities | [ComponentSystem](../../Samples/Packages/com.unity.entities/Unity.Entities/ComponentSystem.cs) | Abstract Class |
1819
| Unity.Entities | [ComponentType](../../Samples/Packages/com.unity.entities/Unity.Entities/Types/ComponentType.cs) | Struct |
20+
| Unity.Entities | [DynamicBuffer](../../Samples/Packages/com.unity.entities/Unity.Entities/Iterators/DynamicBuffer.cs) | Unsafe Struct |
1921
| Unity.Entities | [Entity](../../Samples/Packages/com.unity.entities/Unity.Entities/EntityManager.cs) | Struct |
2022
| Unity.Entities | [EntityArchetype](../../Samples/Packages/com.unity.entities/Unity.Entities/EntityManager.cs) | Unsafe Struct |
2123
| Unity.Entities | [EntityCommandBuffer](../../Samples/Packages/com.unity.entities/Unity.Entities/EntityCommandBuffer.cs) | Unsafe Struct |

Documentation/content/chunk_iteration.md

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

Documentation/content/dynamic_buffers.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Dynamic Buffers
22

3-
A dynamic buffer is a type of component data that allows a variable-sized, "stretchy"
4-
buffer to be associated with an Entity. It behaves as a component type that
3+
A `DynamicBuffer` is a type of component data that allows a variable-sized, "stretchy"
4+
buffer to be associated with an `Entity`. It behaves as a component type that
55
carries an internal capacity of a certain number of elements, but can allocate
66
a heap memory block if the internal capacity is exhausted.
77

88
Memory management is fully automatic when using this approach. Memory associated with
9-
dynamic buffers is managed by the Entity Manager so that when a dynamic buffer
9+
`DynamicBuffers` is managed by the `EntityManager` so that when a `DynamicBuffer`
1010
component is removed, any associated heap memory is automatically freed as well.
1111

12-
Dynamic buffers supersede fixed array support which has been removed.
12+
`DynamicBuffers` supersede fixed array support which has been removed.
1313

1414
## Declaring Buffer Element Types
1515

16-
To declare a buffer, you declare it with the type of element that you will be
17-
putting into the buffer:
16+
To declare a `Buffer`, you declare it with the type of element that you will be
17+
putting into the `Buffer`:
1818

1919
// This describes the number of buffer elements that should be reserved
2020
// in chunk data for each instance of a buffer. In this case, 8 integers
@@ -31,21 +31,21 @@ putting into the buffer:
3131
public int Value;
3232
}
3333

34-
While it seem strange to describe the element type and not the buffer itself,
34+
While it seem strange to describe the element type and not the `Buffer` itself,
3535
this design enables two key benefits in the ECS:
3636

37-
1. It supports having more than one dynamic buffer of type `float3`, or any
38-
other common value type. You can add any number of buffers that leverage the
37+
1. It supports having more than one `DynamicBuffer` of type `float3`, or any
38+
other common value type. You can add any number of `Buffers` that leverage the
3939
same value types, as long as the elements are uniquely wrapped in a top-level
4040
struct.
4141

42-
2. We can include buffer element types in Entity archetypes, and it generally
42+
2. We can include `Buffer` element types in `EntityArchetypes`, and it generally
4343
will behave like having a component.
4444

4545
## Adding Buffer Types To Entities
4646

47-
To add a buffer to an Entity, you can use the normal methods of adding a
48-
component type onto an Entity:
47+
To add a buffer to an `Entity`, you can use the normal methods of adding a
48+
component type onto an `Entity`:
4949

5050
### Using AddBuffer()
5151

@@ -57,7 +57,7 @@ component type onto an Entity:
5757

5858
## Accessing Buffers
5959

60-
There are several ways to access dynamic buffers, which parallel access methods
60+
There are several ways to access `DynamicBuffers`, which parallel access methods
6161
to regular component data.
6262

6363
### Direct, main-thread only access
@@ -67,8 +67,8 @@ to regular component data.
6767
### Injection based access
6868

6969
Similar to `ComponentDataArray` you can inject a `BufferArray` which provides
70-
the dynamic buffers in a parallel array to the other injections. This example
71-
provides a system that appends a value to every buffer in an injected set:
70+
the `DynamicBuffers` in a parallel array to the other injections. This example
71+
provides a system that appends a value to every `Buffer` in an injected set:
7272

7373
public class InjectionDemo : JobComponentSystem
7474
{
@@ -98,7 +98,7 @@ provides a system that appends a value to every buffer in an injected set:
9898

9999
## Entity based access
100100

101-
You can also look up buffers on a per-entity basis:
101+
You can also look up `Buffers` on a per-`Entity` basis:
102102

103103
var lookup = GetBufferArrayFromEntity<EcsIntElement>();
104104
var buffer = lookup[myEntity];
@@ -108,19 +108,19 @@ You can also look up buffers on a per-entity basis:
108108
## Entity based injection access
109109

110110
Similarly to injecting `ComponentDataFromEntity` you can inject
111-
`BufferDataFromEntity` and look up buffers indirectly.
111+
`BufferDataFromEntity` and look up `Buffers` indirectly.
112112

113113
## Reinterpreting Buffers (experimental)
114114

115-
Buffers can be reinterpreted as a type of the same size. The intention is to
115+
`Buffers` can be reinterpreted as a type of the same size. The intention is to
116116
allow controlled type-punning and to get rid of the wrapper element types when
117117
they get in the way. To reinterpret, simply call `Reinterpret<T>`:
118118

119119
var intBuffer = entityManager.GetBuffer<EcsIntElement>().Reinterpret<int>();
120120

121-
The reinterpreted buffer carries with it the safety handle of the original
122-
buffer, and is safe to use. They use the same underlying buffer header, so
123-
modifications to one reinterpreted buffer will be immediately reflected in
121+
The reinterpreted `Buffer` carries with it the safety handle of the original
122+
`Buffer`, and is safe to use. They use the same underlying `BufferHeader`, so
123+
modifications to one reinterpreted `Buffer` will be immediately reflected in
124124
others.
125125

126126
Note that there are no type checks involved, so it is entirely possible to

Documentation/content/job_system.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
## Concurrent NativeContainer types
66

77
Some `NativeContainer` types also have special rules for allowing safe and deterministic write access from ParallelFor jobs. As an example, the method `NativeHashMap.Concurrent` lets you add items in parallel from [IJobParallelFor](https://docs.unity3d.com/2018.1/Documentation/ScriptReference/Unity.Jobs.IJobParallelFor.html).
8+
9+
## Concurrent EntityCommandBuffers
10+
11+
When using an `EntityCommandBuffer` to issue `EntityManager` commands from ParallelFor jobs, the `EntityCommandBuffer.Concurrent` interface must be used in order to guarantee thread safety and deterministic playback. The public methods in this interface take an extra `jobIndex` parameter, which is used to play back the recorded commands in a deterministic order. `jobIndex` must be a unique ID for each job. For performance reasons, `jobIndex` should be related to the (increasing) `index` values passed to `IJobParallelFor.Execute()`. Unless you *really* know what you're doing, using `index` as `jobIndex` is the safest choice. Using other `jobIndex` values will produce correct output, but can have severe performance implications in some cases.

Documentation/content/system_state_components.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
## Concept
1010

11-
The general use of a SystemStateComponent is expected to mirror a user component, providing the internal state.
11+
The general use of a [SystemStateComponent](system_state_components.md) is expected to mirror a user component, providing the internal state.
1212

1313
For instance, given:
14-
- FooComponent (ComponentData, user assigned)
15-
- FooStateComponent (SystemComponentData, system assigned)
14+
- FooComponent (`ComponentData`, user assigned)
15+
- FooStateComponent (`SystemComponentData`, system assigned)
1616

1717
### Detecting Component Add
1818

@@ -24,12 +24,12 @@ When user removes FooComponent, FooStateComponent still exists. The FooSystem up
2424

2525
### Detecting Destroy Entity
2626

27-
DestroyEntity is actually a shorthand utility for:
27+
`DestroyEntity` is actually a shorthand utility for:
2828
- Find Components which reference given Entity ID.
2929
- Delete Components found
3030
- Recycle Entity ID
3131

32-
However, SystemStateComponents are not removed on DestroyEntity and the Entity ID is not recycled until the last component is deleted. This gives the System the opportunity to clean up the internal state in the exact same way as with component removal.
32+
However, `SystemStateComponents` are not removed on `DestroyEntity` and the Entity ID is not recycled until the last component is deleted. This gives the System the opportunity to clean up the internal state in the exact same way as with component removal.
3333

3434
## SystemStateComponent
3535

@@ -41,7 +41,7 @@ struct FooStateComponent : ISystemStateComponentData
4141
}
4242
```
4343

44-
Visibility of a SystemStateComponent is also controlled in the same way as a Component (using `private`, `public`, `internal`) However, it's expected, as a general rule, that a SystemStateComponent will be ReadOnly outside the system that creates it.
44+
Visibility of a `SystemStateComponent` is also controlled in the same way as a `Component` (using `private`, `public`, `internal`) However, it's expected, as a general rule, that a `SystemStateComponent` will be `ReadOnly` outside the system that creates it.
4545

4646
## SystemStateSharedComponent
4747

Documentation/content/transform_system.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# TransformSystem
22

3-
TransformSystem is responsible for updating the `LocalToWorld` transformation matrices used by other systems (including rendering).
3+
[TransformSystem](transform_system.md) is responsible for updating the `LocalToWorld` transformation matrices used by other systems (including rendering).
44

55
## Updating a TransformSystem
66

7-
By default, Unity updates a single TransformSystem instance each frame. `EndFrameTransformSystem` is updated before `EndFrameBarrier` and requires no additional work.
7+
By default, Unity updates a single `TransformSystem` instance each frame. `EndFrameTransformSystem` is updated before `EndFrameBarrier` and requires no additional work.
88

99
In cases where transform data is required to be updated at additional points in the frame, the suggested methods are:
1010

11-
- Create additional instance(s) of TransformSystem and use UpdateBefore/UpdateAfter attributes to control where they are updated.
11+
- Create additional instance(s) of `TransformSystem` and use `UpdateBefore`/`UpdateAfter` attributes to control where they are updated.
1212

1313
For example:
1414

@@ -18,7 +18,7 @@ For example:
1818
{
1919
}
2020
```
21-
- Create additional instance of TransformSystem and update after *every* ComponentSystem (includes Barriers, excludes JobComponentSystem) by using \[ComponentSystemPatch\] attribute. Be aware that the overhead for updating the TransformSystem after every ComponentSystem can be very high when the number of ComponentSystems is large.
21+
- Create additional instance of `TransformSystem` and update after *every* `ComponentSystem` (includes `Barriers`, excludes `JobComponentSystem`) by using \[ComponentSystemPatch\] attribute. Be aware that the overhead for updating the `TransformSystem` after every `ComponentSystem` can be very high when the number of `ComponentSystems` is large.
2222

2323
For example:
2424

@@ -33,7 +33,7 @@ For example:
3333

3434
## Updating Position, Rotation, Scale
3535

36-
The only requirement for TransfromSystem is that *one of* the following components is associated with an Entity:
36+
The only requirement for `TransfromSystem` is that *one of* the following components is associated with an `Entity`:
3737

3838
```
3939
public struct Position : IComponentData
@@ -52,7 +52,7 @@ The only requirement for TransfromSystem is that *one of* the following componen
5252
}
5353
```
5454

55-
TransformSystem will add the `LocalToWorld` component and update the matrix based on the values in your selected associated components (Position, Rotation, and Scale). LocalToWorld does not need to be added by the user or other systems.
55+
`TransformSystem` will add the `LocalToWorld` component and update the matrix based on the values in your selected associated components (`Position`, `Rotation`, and `Scale`). `LocalToWorld` does not need to be added by the user or other systems.
5656

5757
```
5858
public struct LocalToWorld : ISystemStateComponentData
@@ -61,32 +61,32 @@ TransformSystem will add the `LocalToWorld` component and update the matrix base
6161
}
6262
```
6363

64-
LocalToWorld is expected to be ReadOnly by other systems. Be aware that anything written to this component will be overwritten and its behavior during update is undefined if written to.
64+
`LocalToWorld` is expected to be `ReadOnly` by other systems. Be aware that anything written to this component will be overwritten and its behavior during update is undefined if written to.
6565

6666
## Freezing transforms
6767

68-
In many cases, individual transforms are *never* expected to change at runtime. For these types of objects, if a Static component is added:
68+
In many cases, individual transforms are *never* expected to change at runtime. For these types of objects, if a `Static` component is added:
6969

7070
```
7171
public struct Static : IComponentData
7272
{
7373
}
7474
```
7575

76-
They will cease to be updated after the LocalToWorld matrix has been created and updated for the first time. Any changes to associated Position, Rotation, or Scale components will be ignored. Marking `Static` transforms can substantially reduce the amount of work a TransformSystem needs to do which will improve performance.
76+
They will cease to be updated after the `LocalToWorld` matrix has been created and updated for the first time. Any changes to associated `Position`, `Rotation`, or `Scale` components will be ignored. Marking `Static` transforms can substantially reduce the amount of work a `TransformSystem` needs to do which will improve performance.
7777

7878
The process of freezing is:
79-
1. TransformSystem update queries for Static components.
80-
2. TransformSystem adds FrozenPending component.
81-
3. TransformSystem updates the LocalToWorld component normally.
82-
4. On the next TransformSystem update, queries for FrozenPending components and adds Frozen component.
83-
5. TransformSystem ignores Position, Rotation, or Scale components if there is an associated Frozen component.
79+
1. `TransformSystem` update queries for `Static` components.
80+
2. `TransformSystem` adds `FrozenPending` component.
81+
3. `TransformSystem` updates the `LocalToWorld` component normally.
82+
4. On the next `TransformSystem` update, queries for `FrozenPending` components and adds Frozen component.
83+
5. `TransformSystem` ignores `Position`, `Rotation`, or `Scale` components if there is an associated Frozen component.
8484

8585
If necessary, users can detect if LocalToWorld matrix is frozen by existence of a `Frozen` component. Generally however, identifying static objects by the existence of the `Static` component is sufficient.
8686

8787
## Custom transforms
8888

89-
In cases where user systems require custom transformation matrices and updates, the TransformSystem will ignore components associated with a `CustomLocalToWorld` component.
89+
In cases where user systems require custom transformation matrices and updates, the `TransformSystem` will ignore components associated with a `CustomLocalToWorld` component.
9090

9191
```
9292
public struct CustomLocalToWorld : IComponentData
@@ -109,7 +109,7 @@ Attaching transformations (transformation hierarchies) is controlled by separate
109109
}
110110
```
111111

112-
To attach a Child Entity to a Parent Entity, create a new Entity with an associated Attach component, assigning the respective values.
112+
To attach a Child `Entity` to a Parent `Entity`, create a new `Entity` with an associated `Attach` component, assigning the respective values.
113113

114114
For example:
115115

@@ -124,9 +124,9 @@ For example:
124124
m_Manager.SetComponentData(attach, new Attach {Parent = parent, Child = child});
125125
```
126126

127-
1. The Attach component, and associated Entity, will be destroyed by the TransformSystem on update.
128-
2. Values in Position, Rotation, and Scale components will be interpreted as relative to parent space.
129-
3. Attached, Parent, and LocalToParent components will be associated with the Child Entity.
127+
1. The `Attach` component, and associated `Entity`, will be destroyed by the `TransformSystem` on update.
128+
2. Values in `Position`, `Rotation`, and `Scale` components will be interpreted as relative to parent space.
129+
3. `Attached`, `Parent`, and `LocalToParent` components will be associated with the Child `Entity`.
130130

131131
```
132132
public struct Attached : IComponentData
@@ -146,11 +146,11 @@ For example:
146146

147147
## Detaching transformations
148148

149-
To detach a child from a parent, remove the `Attached` component from the child. When the TransformSystem is updated, the Parent component will be removed. Values in Position, Rotation, and Scale components will be interpreted as relative to world space.
149+
To detach a child from a parent, remove the `Attached` component from the child. When the `TransformSystem` is updated, the Parent component will be removed. Values in `Position`, `Rotation`, and `Scale` components will be interpreted as relative to world space.
150150

151151
## Reading World values
152152

153-
The LocalToWorld matrix can be used to retrieve world positions.
153+
The `LocalToWorld` matrix can be used to retrieve world positions.
154154
For example:
155155

156156
```

ReleaseNotes.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# 0.0.12
2+
## New Features
3+
4+
## Upgrade guide
5+
* OnCreateManager(int capacity) -> OnCreateManager(). All your own systems have to be changed to follow the new signature.
6+
7+
## Changes
8+
* Removed capacity parameter from from ScriptBehaviourManager.OnCreateManager.
9+
* EntityDebugger now displays the declaring type for nested types
10+
* IncrementalCompiler is no longer a dependency on the entities package. If you want to continue to use it you need to manually include it from the package manager UI for your project.
11+
* `EntityCommandBuffer.Concurrent` playback is now deterministic. Playback order is determined by the new `jobIndex` parameter accepted by all public API methods, which must be a unique ID per job (such as the index passed to `Execute()` in an IJobParallelFor).
12+
13+
## Fixes
14+
* Fixed bug where ComponentDataWrapper fields spilled out of their area in the Inspector.
15+
* ComponentDataWrapper for empty data types (i.e. tags) no longer displays error in Inspector if wrapped type is not serializable.
16+
* Fixed an issue where EntityDebugger was slow if you scrolled down past 3 million entities
17+
118
# 0.0.11
219
## New Features
320
* Global `Disabled` component. Any component data associated with same entity referenced by `Disabled` component will be ignored by all system updates.

Samples/Assets/Dungeon/Scripts/BoardSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ protected override void OnUpdate()
286286
boardEntities.Dispose();
287287
}
288288

289-
protected override void OnCreateManager(int capacity)
289+
protected override void OnCreateManager()
290290
{
291291
OuterWallTileGroup = GetComponentGroup(
292292
ComponentType.ReadOnly(typeof(BoardReference)),

Samples/Assets/Dungeon/Scripts/FloorTileComponent.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
using Unity.Entities;
1+
using System;
2+
using Unity.Entities;
23

34
namespace Samples.Dungeon.First
45
{
6+
[Serializable]
57
public struct FloorTile : IComponentData
68
{
79
}

Samples/Assets/Dungeon/Scripts/OuterWallTileComponent.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
using Unity.Entities;
1+
using System;
2+
using Unity.Entities;
23

34
namespace Samples.Dungeon.First
45
{
6+
[Serializable]
57
public struct OuterWallTile : IComponentData
68
{
79
}

0 commit comments

Comments
 (0)