Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.2.0-pre.12] - 2024-02-13

### Added

* A file with the code for both snippets in the custom transforms documentation was added to the "DocCodeSamples.Tests" folder.
* The Create Menu now offers ScriptTemplates for the IComponentData, ISystem, IJobEntity and Baker types under Assets/Create/Entities

### Changed

* Fixed infinite loop that could occur due to concurrent use of non-concurrent Dictionary in Aspect Generator.
* Reduce the set/restore frequency of the fixed rate system group allocator.
* Various performance improvements in baking. Baking mesh-heavy scenes now takes 70% of what it did before.
* Significant performance improvements when creating archetypes and entity queries in Worlds with a large number of existing archetypes/queries.
* Updated Burst dependency to version 1.8.12

### Fixed

* EntityQuery singleton methods now correctly handle cases where the query contains enableable components. Note that `GetSingletonEntity()` and `TryGetSingletonEntity()` still can not be used on queries with enableable components, and that the singleton component itself can not be enableable. Both constraints may be lifted in a future release.
* A broken link to a code snippet in the documentation for custom transforms was fixed.
* Archetype window and Entity Memory Profiler module UI initialization.
* Making a player build with define `UNITY_DOTS_DEBUG`, while using an IJobEntity using RefRO/RefRW no longer compile errors!
* Clarified documentation for cleanup components
* Fixed minor memory leak in content delivery system.
* AABB.Contains.
* The entities hierarchy view would sometimes throw exceptions when entities were destroyed.
* remove use of UNITY_64 define, as is can not be reliably used to determine 64 bit nature of platforms. Fixes crashes related to pointer truncation.
  • Loading branch information
Unity Technologies committed Feb 13, 2024
1 parent ce54688 commit 0783fbd
Show file tree
Hide file tree
Showing 96 changed files with 1,805 additions and 525 deletions.
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,33 @@
uid: changelog
---

# Changelog
## [1.2.0-pre.12] - 2024-02-13

### Added

* A file with the code for both snippets in the custom transforms documentation was added to the "DocCodeSamples.Tests" folder.
* The Create Menu now offers ScriptTemplates for the IComponentData, ISystem, IJobEntity and Baker types under Assets/Create/Entities

### Changed

* Fixed infinite loop that could occur due to concurrent use of non-concurrent Dictionary in Aspect Generator.
* Reduce the set/restore frequency of the fixed rate system group allocator.
* Various performance improvements in baking. Baking mesh-heavy scenes now takes 70% of what it did before.
* Significant performance improvements when creating archetypes and entity queries in Worlds with a large number of existing archetypes/queries.
* Updated Burst dependency to version 1.8.12

### Fixed

* EntityQuery singleton methods now correctly handle cases where the query contains enableable components. Note that `GetSingletonEntity()` and `TryGetSingletonEntity()` still can not be used on queries with enableable components, and that the singleton component itself can not be enableable. Both constraints may be lifted in a future release.
* A broken link to a code snippet in the documentation for custom transforms was fixed.
* Archetype window and Entity Memory Profiler module UI initialization.
* Making a player build with define `UNITY_DOTS_DEBUG`, while using an IJobEntity using RefRO/RefRW no longer compile errors!
* Clarified documentation for cleanup components
* Fixed minor memory leak in content delivery system.
* AABB.Contains.
* The entities hierarchy view would sometimes throw exceptions when entities were destroyed.
* remove use of UNITY_64 define, as is can not be reliably used to determine 64 bit nature of platforms. Fixes crashes related to pointer truncation.


## [1.2.0-pre.6] - 2023-12-13

Expand All @@ -28,6 +54,7 @@ uid: changelog
* Selecting entities and systems now works again.



## [1.2.0-exp.3] - 2023-11-09

### Added
Expand Down
62 changes: 62 additions & 0 deletions DocCodeSamples.Tests/TransformsCustom.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.Globalization;
using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;

namespace Miscellaneous.CustomTransforms
{
#region Transform2DAuthoring
public class Transform2DAuthoring : MonoBehaviour
{
class Baker : Baker<Transform2DAuthoring>
{
public override void Bake(Transform2DAuthoring authoring)
{
// Ensure that no standard transform components are added.
var entity = GetEntity(TransformUsageFlags.ManualOverride);
AddComponent(entity, new LocalTransform2D
{
Scale = 1
});
AddComponent(entity, new LocalToWorld
{
Value = float4x4.Scale(1)
});

var parentGO = authoring.transform.parent;
if (parentGO != null)
{
AddComponent(entity, new Parent
{
Value = GetEntity(parentGO, TransformUsageFlags.None)
});
}
}
}
}
#endregion

#region LocalTransform2D
// By including LocalTransform2D in the LocalToWorld write group, entities
// with LocalTransform2D are not processed by the standard transform system.
[WriteGroup(typeof(LocalToWorld))]
public struct LocalTransform2D : IComponentData
{
public float2 Position;
public float Scale;
public float Rotation;

public override string ToString()
{
return $"Position={Position.ToString()} Rotation={Rotation.ToString()} Scale={Scale.ToString(CultureInfo.InvariantCulture)}";
}

public float4x4 ToMatrix()
{
quaternion rotation = quaternion.RotateZ(math.radians(Rotation));
return float4x4.TRS(new float3(Position.xy, 0f), rotation, Scale);
}
}
#endregion
}
11 changes: 11 additions & 0 deletions DocCodeSamples.Tests/TransformsCustom.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Documentation~/baking-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The output of a full baking pass is a set of files on the disk. The Editor or yo

When a subscene loads an authoring scene, it also initializes incremental baking. Performing an incremental baking pass on the scene means that you can directly access the results of baking while you edit an authoring scene.

During incremental baking, baking happens in memory instead of doing a run-trip to the disk. When you change the contents of authoring GameObjects, Unity re-bakes only the entities and components affected. Baking only a small subset of the data is much faster, and means ECS data can update in real time. This effectively gives the impression of directly editing ECS data, even though baking is continuously happening.
During incremental baking, baking happens in memory instead of doing a round-trip to the disk. When you change the contents of authoring GameObjects, Unity re-bakes only the entities and components affected. Baking only a small subset of the data is much faster, and means ECS data can update in real time. This effectively gives the impression of directly editing ECS data, even though baking is continuously happening.

Incremental baking comes with some additional complexity. While full baking always starts from a blank slate and systematically bakes everything, incremental baking always runs on top of the earlier baking pass and only bakes the entities that depend on the authoring GameObjects that have changed.

Expand Down
2 changes: 1 addition & 1 deletion Documentation~/baking.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Baking

Baking is a process that transforms GameObject data in the Unity Editor (authoring data) into to entities written to entity scenes (runtime data).
Baking is a process that transforms GameObject data in the Unity Editor (authoring data) into entities written to entity scenes (runtime data).

|**Topic**|**Description**|
|---|---|
Expand Down
7 changes: 6 additions & 1 deletion Documentation~/components-cleanup-introducing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ bool entityExists = EntityManager.Exists(e);

> [!NOTE]
> Cleanup components are unmanaged and have all of the same restrictions as [unmanaged components](components-unmanaged.md).
>
> The following limitations also apply:
> - Cleanup components are not included when entities are copied between Worlds.
> - As a consequence, cleanup components added at baking time will not be serialized.
> - Cleanup components on prefab entities will not be included on instantiated instances of that prefab.
## Additional resources
* [Unmanaged components](components-unmanaged.md)
* [Unmanaged components](components-unmanaged.md)
2 changes: 1 addition & 1 deletion Documentation~/components-cleanup-shared.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cleanup shared components

Cleanup shared components are managed [shared components](components-shared.md) that have the destruction semantics of a [cleanup component](components-cleanup.md). They are useful to tag entities that require the same information for clean up.
Cleanup shared components are [shared components](components-shared.md) that have the destruction semantics of a [cleanup component](components-cleanup.md). They are useful to tag entities that require the same information for clean up.

## Create a cleanup shared component

Expand Down
2 changes: 1 addition & 1 deletion Documentation~/components-nativecontainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A `NativeContainer` is safer and consistently meets expectations than an `Unsafe

## Component limitations

If you put a container types in a component, they have the following limitations:
If you put container types in a component, they have the following limitations:

|**Functionality**|**Native containers**|**Unsafe containers**|
|--|--|--|
Expand Down
7 changes: 6 additions & 1 deletion Documentation~/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ See the [DOTS Guide and Samples](https://github.com/Unity-Technologies/EntityCom

![](images/entities-splash-image.png)

## Supported Unity Versions

* 2022.3 (LTS)
* 2023.3 (Latest Beta and beyond)

## Package installation

To use the Entities package, you must have a 2022.3 version of Unity installed.
To use the Entities package, you must have a supported version of Unity installed.

To install the package, open the Package Manager window (**Window &gt; Package Manager**) and perform one of the following options:

Expand Down
41 changes: 3 additions & 38 deletions Documentation~/transforms-custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,8 @@ To create your own custom transform system, you have to substitute the `LocalTra

1. Create a .cs file that defines a substitute for the built-in `LocalTransform` component. You can copy the built-in `LocalTransform.cs` file from the Entities package into your assets folder and then edit the contents. To do this, go to **Packages &gt; Entities &gt; Unity.Transforms** in your project, copy the `LocalTransform.cs` file, and rename it.
1. Change the properties and methods to suit your needs. See the following example of a custom `LocalTransform2D` component:

```c#
using System.Globalization;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Properties;
using Unity.Transforms;

[WriteGroup(typeof(LocalToWorld))]
public struct LocalTransform2D : IComponentData
{
[CreateProperty]
public float2 Position;

[CreateProperty]
public float Scale;

[CreateProperty]
public float Rotation;

public override string ToString()
{
return $"Position={Position.ToString()} Rotation={Rotation.ToString()} Scale={Scale.ToString(CultureInfo.InvariantCulture)}";
}

/// <summary>
/// Gets the float4x4 equivalent of this transform.
/// </summary>
/// <returns>The float4x4 matrix.</returns>
public float4x4 ToMatrix()
{
quaternion rotation = quaternion.RotateZ(math.radians(Rotation));
var matrixTRS = float4x4.TRS(new float3(Position.xy, 0f), rotation, Scale);
return matrixTRS;
}
}
```

[!code-cs[LocalTransform2DDocsSnippet](../DocCodeSamples.Tests/TransformsCustom.cs#LocalTransform2D)]

The above example modifies the built-in `LocalTransform` in the following ways:

Expand All @@ -82,7 +47,7 @@ Each entity that your custom transform system needs to process must fulfill the

To meet this criteria, add an authoring component to each entity, and use [transform usage flags](xref:Unity.Entities.TransformUsageFlags) to prevent the entity from receiving any components from the built-in transform system:

[!code-cs[Transform2DAuthoringDocsSnippet](../../../Projects/EntitiesSamples/Assets/Custom%20Transform%20System/Authoring/Transform2DAuthoring.cs#Transform2DAuthoringDocsSnippet)]
[!code-cs[Transform2DAuthoringDocsSnippet](../DocCodeSamples.Tests/TransformsCustom.cs#Transform2DAuthoring)]

The above example adds the custom `LocalTransform2D` component and the built-in `LocalToWorld` component to the authoring component. If applicable, it also adds a `Parent` component that points to the entity's parent entity.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
-unity-text-align: middle-left;
}

#tree-view-container
{
flex-grow: 1;
}
.memory-profiler-left-pane__tree-view
{
flex-grow: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
-unity-text-align: middle-left;
}

#tree-view-container
{
flex-grow: 1;
}
.structural-changes-profiler-window__tree-view
{
flex-grow: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<ui:Label name="column2" class="memory-profiler-left-pane__column2"/>
<ui:Label name="column3" class="memory-profiler-left-pane__column3"/>
</ui:VisualElement>
<uib:TreeView name="tree-view" item-height="18" class="memory-profiler-left-pane__tree-view"/>
<ui:VisualElement name="tree-view-container" />
</ui:VisualElement>
</UXML>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<ui:Label name="column2" class="structural-changes-profiler-window__column2"/>
<ui:Label name="column3" class="structural-changes-profiler-window__column3"/>
</ui:VisualElement>
<uib:TreeView name="tree-view" item-height="18" class="structural-changes-profiler-window__tree-view"/>
<ui:VisualElement name="tree-view-container" />
</ui:VisualElement>
</UXML>
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Entities © 2023 Unity Technologies
Entities © 2024 Unity Technologies

Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license).

Expand Down
8 changes: 8 additions & 0 deletions Unity.Entities.Editor.Tests/ScriptTemplates.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using UnityEditor;
using NUnit.Framework;
using UnityEngine;

namespace Unity.Entities.Editor.Tests
{
class ScriptTemplatesTests
{
string[] paths = new string[]
{
$"{ScriptTemplates.ScriptTemplatePath}IComponentDataTemplate.txt",
$"{ScriptTemplates.ScriptTemplatePath}ISystemTemplate.txt",
$"{ScriptTemplates.ScriptTemplatePath}IJobEntityTemplate.txt",
$"{ScriptTemplates.ScriptTemplatePath}BakerTemplate.txt",
};

[Test]
public void ScriptTemplatesExist()
{
for (int i = 0; i < paths.Length; i++)
{
var asset = AssetDatabase.LoadAssetAtPath<TextAsset>(paths[i]);

Assert.NotNull(asset);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0783fbd

Please sign in to comment.