-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [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
Showing
96 changed files
with
1,805 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
Unity.Entities.Editor.Tests/ScriptTemplates/ScriptTemplatesTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Unity.Entities.Editor.Tests/ScriptTemplates/ScriptTemplatesTests.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.