diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c915c69..74ab5686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ uid: changelog # Changelog + +## [1.2.4] - 2024-08-14 + +* Debug proxies (used by external debuggers) were sometimes using invalid field offsets when inspecting structs in blob assets. This led to incorrect values being reported in debugger watch windows. In particular, this would be triggered by the use of bool fields in blob asset structs. +* Entity version numbers could go back to 1 after reallocation in some edge cases. +* When building a content update, a temporary path was getting created in the drive root instead of the Library folder. This would also cause content update builds to grow in size every time they were built. The folder is now created in the Library correctly. +* Error in build when sprites are contained in subscenes has been removed. +* Regression in compilation time with assemblies with lots of system methods. +* EntityComponentStore leaked memory during domain reload. + + ## [1.2.3] - 2024-05-30 ### Fixed @@ -20,6 +31,7 @@ uid: changelog ## [1.2.1] - 2024-04-26 + ### Changed * Updated Burst dependency to version 1.8.13 diff --git a/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyDataModeFilteringTests.cs b/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyDataModeFilteringTests.cs index 4869ea1f..05ca26e9 100644 --- a/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyDataModeFilteringTests.cs +++ b/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyDataModeFilteringTests.cs @@ -46,22 +46,21 @@ void BuildTestHierarchy(bool isSubSceneOpened, out HierarchyNodeStore.Immutable var emptyArchetype = m_World.EntityManager.CreateArchetype(); var entities = m_World.EntityManager.CreateEntity(emptyArchetype, 11, Allocator.Temp); - // This test relies on entities having specific indices and versions. + // This test relies on entities having specific indices. // But it also requires those entities to effectively exists. // As long as it runs in an empty world, it should be fine. // The following loop makes sure of that. for (int i = 0; i < entities.Length; i++) { Assert.AreEqual(entities[i].Index, i); - Assert.AreEqual(entities[i].Version, 1); } - var entityA = m_HierarchyNodeStore.AddNode(new HierarchyNodeHandle(NodeKind.Entity, 5, 1), subSceneNode); - var entityB = m_HierarchyNodeStore.AddNode(new HierarchyNodeHandle(NodeKind.Entity, 6, 1), subSceneNode); - var entityC = m_HierarchyNodeStore.AddNode(new HierarchyNodeHandle(NodeKind.Entity, 7, 1)); - var entityD = m_HierarchyNodeStore.AddNode(new HierarchyNodeHandle(NodeKind.Entity, 8, 1)); + var entityA = m_HierarchyNodeStore.AddNode(HierarchyNodeHandle.FromEntity(entities[5]), subSceneNode); + var entityB = m_HierarchyNodeStore.AddNode(HierarchyNodeHandle.FromEntity(entities[6]), subSceneNode); + var entityC = m_HierarchyNodeStore.AddNode(HierarchyNodeHandle.FromEntity(entities[7])); + var entityD = m_HierarchyNodeStore.AddNode(HierarchyNodeHandle.FromEntity(entities[8])); dynamicSubSceneNode = m_HierarchyNodeStore.AddNode(new HierarchyNodeHandle(NodeKind.SubScene, 9), HierarchyNodeHandle.Root); - m_HierarchyNodeStore.AddNode(new HierarchyNodeHandle(NodeKind.Entity, 10, 1), dynamicSubSceneNode); + m_HierarchyNodeStore.AddNode(HierarchyNodeHandle.FromEntity(entities[10]), dynamicSubSceneNode); m_HierarchyNodeStore.SetSortIndex(entityA, 3); m_HierarchyNodeStore.SetSortIndex(entityB, 4); m_HierarchyNodeStore.SetSortIndex(entityC, 2); diff --git a/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyNodeStoreTests.cs b/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyNodeStoreTests.cs index 6497e92b..da0568da 100644 --- a/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyNodeStoreTests.cs +++ b/Unity.Entities.Editor.Tests/Hierarchy/Model/HierarchyNodeStoreTests.cs @@ -19,19 +19,6 @@ public void SetUp() { m_World = new World(nameof(HierarchyNodeStoreTests)); m_HierarchyNodeStore = new HierarchyNodeStore(Allocator.Persistent); - - var emptyArchetype = m_World.EntityManager.CreateArchetype(); - var entities = m_World.EntityManager.CreateEntity(emptyArchetype, 11, Allocator.Temp); - - // Some of these tests rely on entities having specific indices and versions. - // But they also require those entities to effectively exist. - // As long as they run in an empty world, they should be fine. - // The following loop makes sure of that. - for (int i = 0; i < entities.Length; i++) - { - Assert.AreEqual(entities[i].Index, i); - Assert.AreEqual(entities[i].Version, 1); - } } [TearDown] diff --git a/Unity.Entities.Tests/BlobDebugTests.cs b/Unity.Entities.Tests/BlobDebugTests.cs index cba162f2..a038a6fc 100644 --- a/Unity.Entities.Tests/BlobDebugTests.cs +++ b/Unity.Entities.Tests/BlobDebugTests.cs @@ -12,6 +12,8 @@ using Assert = NUnit.Framework.Assert; using Unity.Mathematics; using System.IO; +using System.Linq; +using System.Runtime.InteropServices; using Unity.Entities.DebugProxies; using Unity.Entities.Serialization; using Unity.Entities.LowLevel.Unsafe; @@ -51,6 +53,13 @@ struct BlobWithStringNestedInArray public BlobArray ArrayOfStrings; } + struct BlobStructWithALayoutThatDoesntMatchItsMarshallingLayout + { + public bool a; + public bool b; + public int c; + } + [Test] public void BlobAssetReferenceDebugProxy_CanDisplayInvalidValues() { @@ -192,4 +201,55 @@ public void BlobAssetReferenceDebugProxy_WorksWithStringNestedInArray() var arr = (BlobArrayDebug)bs.Members[1].Value; CollectionAssert.AreEqual(new []{"One", "Two", "Three"}, arr.Entries); } + + [Test] + public void BlobAssetReferenceDebugProxy_WorksWithTypesHavingADifferentMarshallingLayout() + { + // The struct contains the following fields: + // a : bool + // b : bool + // c : int + // In memory, boolean values might take only one byte, so the layout would be: + // a : size 1 offset 0 + // b : size 1 offset 1 + // c : size 4 offset 4 + // The full size of the struct being 8 bytes, with two bytes of padding between b and c. + + // That exact memory layout is not guaranteed as far as I can tell. + + // But the marshalling struct uses 4 bytes for booleans, giving the following layout: + // a : size 4 offset 0 + // b : size 4 offset 4 + // c : size 4 offset 8 + // The full size being now 12 bytes, with no padding. + + // This test validates that debugging proxies for blobs using such a struct will display the + // right data. We used to mistakenly have a mix of marshalled and non-marshalled field offsets in there. + + unsafe + { + var actualSize = sizeof(BlobStructWithALayoutThatDoesntMatchItsMarshallingLayout); + var marshallSize = Marshal.SizeOf(); + + // Making sure that we are testing the right stuff, the marshalled struct shouldn't be identical to the raw struct. + // If this test fails, I guess a more complicated struct will be required. + Assert.AreNotEqual(actualSize, marshallSize); + } + + var builder = new BlobBuilder(Allocator.Temp); + + { + ref var v = ref builder.ConstructRoot(); + v.a = true; + v.b = false; + v.c = 123; + } + + var bar = builder.CreateBlobAssetReference(Allocator.Temp); + var proxy = new BlobAssetReferenceProxy(bar); + var bs = (BlobStruct) proxy.Value; + + var array = bs.Members.Select(m => $"{m.Key}:{m.Value}").ToArray(); + CollectionAssert.AreEquivalent(new []{ $"a:{true}", $"b:{false}", $"c:{123}" }, array); + } } diff --git a/Unity.Entities/BlobsDebug.cs b/Unity.Entities/BlobsDebug.cs index 90d3edf0..99b8aafb 100644 --- a/Unity.Entities/BlobsDebug.cs +++ b/Unity.Entities/BlobsDebug.cs @@ -138,7 +138,7 @@ void Init() m_Members = new BlobMember[fields.Length]; for (int i = 0; i < m_Members.Length; i++) { - var offset = (byte*) m_BasePtr + Marshal.OffsetOf(fields[i].Name).ToInt32(); + var offset = (byte*) m_BasePtr + UnsafeUtility.GetFieldOffset(fields[i]); m_Members[i] = new BlobMember { Key = fields[i].Name, @@ -195,6 +195,11 @@ public object Value static class BlobProxy { + static unsafe object GetPrimitive(IntPtr basePtr) where T : unmanaged + { + return *(T*)basePtr.ToPointer(); + } + static unsafe string UnpackString(void* basePtr) { // can't get the BlobString itself because that will trigger the Blob asset safety system @@ -227,7 +232,8 @@ internal static unsafe object UnpackValue(void* basePtr, Type type) return Activator.CreateInstance(structType, new IntPtr(basePtr)); } - return Marshal.PtrToStructure(new IntPtr(basePtr), type); + var makePrimitive = typeof(BlobProxy).GetMethod("GetPrimitive", BindingFlags.NonPublic | BindingFlags.Static)!.MakeGenericMethod(type); + return makePrimitive.Invoke(null, new object[] { new IntPtr(basePtr) }); } } } diff --git a/Unity.Entities/DefaultWorldInitialization.cs b/Unity.Entities/DefaultWorldInitialization.cs index 48dfe407..ad72ae4a 100644 --- a/Unity.Entities/DefaultWorldInitialization.cs +++ b/Unity.Entities/DefaultWorldInitialization.cs @@ -91,6 +91,10 @@ internal static void DomainUnloadOrPlayModeChangeShutdown() World.DisposeAllWorlds(); +#if!ENTITY_STORE_V1 + EntityComponentStore.s_entityStore.Data.Dispose(); +#endif + #if (UNITY_EDITOR || DEVELOPMENT_BUILD) && !DISABLE_ENTITIES_JOURNALING EntitiesJournaling.Shutdown(); #endif @@ -181,7 +185,6 @@ public static void AddSystemsToRootLevelSystemGroups(World world, IReadOnlyList< } AddSystemToRootLevelSystemGroupsInternal(world, systemTypeIndices); } - /// /// Adds the collection of systems to the world by injecting them into the root level system groups @@ -199,12 +202,11 @@ public static void AddSystemsToRootLevelSystemGroups(World world, params Type[] } AddSystemToRootLevelSystemGroupsInternal(world, indices); } - /// /// Adds the collection of systems to the world by injecting them into the root level system groups /// (InitializationSystemGroup, SimulationSystemGroup and PresentationSystemGroup). This version avoids - /// unnecessary reflection. + /// unnecessary reflection. /// /// The World in which the root-level system groups should be created. /// The system types to create and add. @@ -243,7 +245,7 @@ internal static unsafe void AddSystemToRootLevelSystemGroupsInternal(World wo throw new InvalidOperationException("Bad type"); if (stype.IsManaged) managedTypes.Add(stype); - else + else unmanagedTypes.Add(stype); } @@ -297,7 +299,7 @@ internal static void AddSystemToRootLevelSystemGroupsInternal(World world, Nativ private static ComponentSystemGroup FindGroup(World world, SystemTypeIndex systemType, TypeManager.SystemAttribute attr) { var groupTypeIndex = attr.TargetSystemTypeIndex; - + if (!TypeManager.IsSystemTypeIndex(groupTypeIndex) || !groupTypeIndex.IsGroup) { throw new InvalidOperationException($"Invalid [{nameof(UpdateInGroupAttribute)}] attribute for {systemType}: target group must be derived from {nameof(ComponentSystemGroup)}."); @@ -360,7 +362,7 @@ public static void DefaultLazyEditModeInitialize() /// /// Calculates a list of all systems filtered with WorldSystemFilterFlags, [DisableAutoCreation] etc. Prefer - /// GetAllSystemTypeIndices where possible to avoid extra reflection. + /// GetAllSystemTypeIndices where possible to avoid extra reflection. /// /// The filter flags to search for. /// Optionally require that [WorldSystemFilter(WorldSystemFilterFlags.Editor)] is present on the system. This is used when creating edit mode worlds. @@ -377,7 +379,7 @@ public static IReadOnlyList GetAllSystems(WorldSystemFilterFlags filterFla return ret; } - + /// /// Calculates a list of all systems filtered with WorldSystemFilterFlags, [DisableAutoCreation] etc. /// Prefer this over GetAllSystems if possible, to avoid extra reflection usage. diff --git a/Unity.Entities/EntityComponentStoreEntities.cs b/Unity.Entities/EntityComponentStoreEntities.cs index ac43bd52..c0d7f50e 100644 --- a/Unity.Entities/EntityComponentStoreEntities.cs +++ b/Unity.Entities/EntityComponentStoreEntities.cs @@ -49,18 +49,15 @@ public void IntegrityCheck(int blockIndex) var block = (DataBlock*)m_DataBlocks[blockIndex]; - var emptyA = block == null; - var emptyB = m_EntityCount[blockIndex] == 0; - - if (emptyA != emptyB) + if(block == null) { - Debug.Log($"block index {blockIndex} pointer {(ulong)block:X16} count {m_EntityCount[blockIndex]}"); - } + Assert.AreEqual(0, m_EntityCount[blockIndex]); - Assert.AreEqual(emptyA, emptyB); + if(m_EntityCount[blockIndex] != 0) + { + Debug.Log($"block index {blockIndex} pointer {(ulong)block:X16} count {m_EntityCount[blockIndex]}"); + } - if (block == null) - { return; } @@ -85,7 +82,7 @@ public void IntegrityCheck() } } - public int EntityCount + public int DebugOnlyThreadUnsafeEntityCount { get { @@ -127,13 +124,8 @@ internal Entity GetEntityByEntityIndex(int index) var block = (DataBlock*)m_DataBlocks[blockIndex]; if (block == null) return Entity.Null; - var bitfield = block->allocated[indexInBlock / 64]; - var mask = 1UL << (indexInBlock % 64); - - if ((bitfield & mask) == 0) return Entity.Null; - var version = block->versions[indexInBlock]; - return new Entity { Index = index, Version = version }; + return ((uint)version & 1) == 0 ? Entity.Null : new Entity { Index = index, Version = version }; } internal bool Exists(Entity entity) @@ -144,14 +136,7 @@ internal bool Exists(Entity entity) var block = (DataBlock*)m_DataBlocks[blockIndex]; if (block == null) return false; - var bitfield = block->allocated[indexInBlock / 64]; - var mask = 1UL << (indexInBlock % 64); - - if ((bitfield & mask) == 0) return false; - - var version = block->versions[indexInBlock]; - if (version != entity.Version) return false; - + if (((uint)entity.Version & 1) == 0 || block->versions[indexInBlock] != entity.Version) return false; return true; } @@ -234,18 +219,16 @@ internal void AllocateEntities(Entity* entities, int totalCount, ChunkIndex chun continue; } - DataBlock* block; + DataBlock* block = (DataBlock*)m_DataBlocks[i]; - if (blockCount == 0) + // Be careful that the block might exist even if the count is zero, checking the pointer + // for null is the only valid way to tell if the block exists or not. + if (block == null) { block = (DataBlock*)Memory.Unmanaged.Allocate(k_BlockSize, 8, Allocator.Persistent); UnsafeUtility.MemClear(block, k_BlockSize); m_DataBlocks[i] = (ulong)block; } - else - { - block = (DataBlock*)m_DataBlocks[i]; - } int remainingCount = math.min(blockAvailable, count); var allocated = block->allocated; @@ -432,11 +415,7 @@ internal void DeallocateEntities(Entity* entities, int count) } } - if (blockCount == 0) - { - Memory.Unmanaged.Free(block, Allocator.Persistent); - m_DataBlocks[blockIndex] = 0; - } + // Do not deallocate the block even if it's empty. Versions should be preserved. { var resultCheck = Interlocked.CompareExchange(ref m_EntityCount[blockIndex], blockCount, k_BlockBusy); diff --git a/Unity.Entities/SourceGenerators/AspectGenerator.dll b/Unity.Entities/SourceGenerators/AspectGenerator.dll index 088b78aa..487aea0b 100644 Binary files a/Unity.Entities/SourceGenerators/AspectGenerator.dll and b/Unity.Entities/SourceGenerators/AspectGenerator.dll differ diff --git a/Unity.Entities/SourceGenerators/AspectGenerator.pdb b/Unity.Entities/SourceGenerators/AspectGenerator.pdb index 48e34b42..c2fa66e8 100644 Binary files a/Unity.Entities/SourceGenerators/AspectGenerator.pdb and b/Unity.Entities/SourceGenerators/AspectGenerator.pdb differ diff --git a/Unity.Entities/SourceGenerators/Common.dll b/Unity.Entities/SourceGenerators/Common.dll index 963edbcb..3840daf2 100644 Binary files a/Unity.Entities/SourceGenerators/Common.dll and b/Unity.Entities/SourceGenerators/Common.dll differ diff --git a/Unity.Entities/SourceGenerators/Common.pdb b/Unity.Entities/SourceGenerators/Common.pdb index 9c2340fc..8bd45c34 100644 Binary files a/Unity.Entities/SourceGenerators/Common.pdb and b/Unity.Entities/SourceGenerators/Common.pdb differ diff --git a/Unity.Entities/SourceGenerators/JobEntityGenerator.dll b/Unity.Entities/SourceGenerators/JobEntityGenerator.dll index 8ca3aaf4..c43b254d 100644 Binary files a/Unity.Entities/SourceGenerators/JobEntityGenerator.dll and b/Unity.Entities/SourceGenerators/JobEntityGenerator.dll differ diff --git a/Unity.Entities/SourceGenerators/JobEntityGenerator.pdb b/Unity.Entities/SourceGenerators/JobEntityGenerator.pdb index a239afce..477641c4 100644 Binary files a/Unity.Entities/SourceGenerators/JobEntityGenerator.pdb and b/Unity.Entities/SourceGenerators/JobEntityGenerator.pdb differ diff --git a/Unity.Entities/SourceGenerators/Source~/SystemGenerator.Common/SystemDescription.cs b/Unity.Entities/SourceGenerators/Source~/SystemGenerator.Common/SystemDescription.cs index 2f858d81..8af6237f 100644 --- a/Unity.Entities/SourceGenerators/Source~/SystemGenerator.Common/SystemDescription.cs +++ b/Unity.Entities/SourceGenerators/Source~/SystemGenerator.Common/SystemDescription.cs @@ -83,13 +83,14 @@ public string GetOrCreateEntityCommandBufferSystemField(ITypeSymbol ecbSystemTyp if (containingMember is MethodDeclarationSyntax { Body: not null } methodDeclarationSyntax) { var methodStatements = methodDeclarationSyntax.Body.DescendantNodes().OfType(); + StatementSyntax lastStatement = null; foreach (var statement in methodStatements) { lineDirectiveStatements.Add(statement); - if (statement == methodStatements.Last()) - hiddenDirectiveStatements.Add(statement); - + lastStatement = statement; } + if (lastStatement != null) + hiddenDirectiveStatements.Add(lastStatement); } } diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.Common.dll b/Unity.Entities/SourceGenerators/SystemGenerator.Common.dll index c848796f..eed31056 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.Common.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.Common.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.Common.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.Common.pdb index 8a1ae2dd..ce19c471 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.Common.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.Common.pdb differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.dll b/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.dll index 9c892344..d5194c9f 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.pdb index fae96b6b..4da234f0 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.EntityQueryBulkOperations.pdb differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.dll b/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.dll index 3d12ca37..3e097df2 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.pdb index 57dc8fc2..323430bc 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.LambdaJobs.pdb differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.dll b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.dll index 6ce0c19d..f492e1b8 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.pdb index 6d37707c..70bd0f03 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.Query.pdb differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.dll b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.dll index 3fd14997..5c1b2fbf 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.pdb index 4873d69d..e7ec3f82 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.QueryBuilder.pdb differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.dll b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.dll index 77a391dc..4fab25d2 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.pdb index 0e0ab324..fa6e7bfc 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.SystemAPI.pdb differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.dll b/Unity.Entities/SourceGenerators/SystemGenerator.dll index 0bb6b24e..b1812412 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.dll and b/Unity.Entities/SourceGenerators/SystemGenerator.dll differ diff --git a/Unity.Entities/SourceGenerators/SystemGenerator.pdb b/Unity.Entities/SourceGenerators/SystemGenerator.pdb index 571f810c..debf2ab5 100644 Binary files a/Unity.Entities/SourceGenerators/SystemGenerator.pdb and b/Unity.Entities/SourceGenerators/SystemGenerator.pdb differ diff --git a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.dll b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.dll index 044510dd..895d7227 100644 Binary files a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.dll and b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.dll differ diff --git a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.pdb b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.pdb index 155d5bb4..b52ba73e 100644 Binary files a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.pdb and b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.CodeFixes.pdb differ diff --git a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.dll b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.dll index 4244f8f9..d0ece72c 100644 Binary files a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.dll and b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.dll differ diff --git a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.pdb b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.pdb index 9398e8f8..6438e61e 100644 Binary files a/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.pdb and b/Unity.Entities/SourceGenerators/Unity.Entities.Analyzer.pdb differ diff --git a/Unity.Scenes.Editor.Tests/SubSceneDeduplicationTests.cs b/Unity.Scenes.Editor.Tests/SubSceneDeduplicationTests.cs index 87de894c..32905abc 100644 --- a/Unity.Scenes.Editor.Tests/SubSceneDeduplicationTests.cs +++ b/Unity.Scenes.Editor.Tests/SubSceneDeduplicationTests.cs @@ -25,7 +25,7 @@ public class SubSceneDeduplicationTests new(string, int[])[] { ("t1.png", new int[] {}), //texture with no refs - ("a1.asset", new int[] { 0 }), //asset with ref to t1.png + ("a1.txt", new int[] { 0 }), //asset with ref to t1.png }, new(int, (int, int[]))[] { @@ -41,8 +41,8 @@ public class SubSceneDeduplicationTests { ("t1.png", new int[] {}), //texture with no refs ("t2.png", new int[] {}), //texture with no refs - ("a1.asset", new int[] { 0, 1 }), //asset with ref to t1.png & t2.png - ("a2.asset", new int[] { 0 }), //asset with ref to t1.png + ("a1.txt", new int[] { 0, 1 }), //asset with ref to t1.png & t2.png + ("a2.txt", new int[] { 0 }), //asset with ref to t1.png }, new(int, (int, int[]))[] { @@ -59,9 +59,9 @@ public class SubSceneDeduplicationTests ("t1.png", new int[] {}), //texture with no refs ("t2.png", new int[] {}), //texture with no refs ("t3.png", new int[] {}), //texture with no refs - ("a1.asset", new int[] { 0, 1 }), //asset with ref to t1.png & t2.png - ("a2.asset", new int[] { 0 }), //asset with ref to t1.png - ("a3.asset", new int[] { 1, 2 }), //asset with ref to t2.png & t3.png + ("a1.txt", new int[] { 0, 1 }), //asset with ref to t1.png & t2.png + ("a2.txt", new int[] { 0 }), //asset with ref to t1.png + ("a3.txt", new int[] { 1, 2 }), //asset with ref to t2.png & t3.png }, new(int, (int, int[]))[] { @@ -80,10 +80,10 @@ public class SubSceneDeduplicationTests ("t2.png", new int[] {}), //texture with no refs ("t3.png", new int[] {}), //texture with no refs ("t4.png", new int[] {}), //texture with no refs - ("a1.asset", new int[] { 0 }), //asset with ref to t1.png - ("a2.asset", new int[] { 1 }), //asset with ref to t2.png - ("a3.asset", new int[] { 2 }), //asset with ref to t3.png - ("a4.asset", new int[] { 3 }), //asset with ref to t4.png + ("a1.txt", new int[] { 0 }), //asset with ref to t1.png + ("a2.txt", new int[] { 1 }), //asset with ref to t2.png + ("a3.txt", new int[] { 2 }), //asset with ref to t3.png + ("a4.txt", new int[] { 3 }), //asset with ref to t4.png }, new(int, (int, int[]))[] { @@ -163,36 +163,33 @@ private EntitySceneBuildUtility.SectionDependencyInfo CreateTestDependencyInfo(I static ObjectIdentifier GetObjectIdentifier(string dir, string path) { path = Path.Combine(dir, path); - if (!File.Exists(path)) - { - var ext = Path.GetExtension(path); - switch (ext) - { - case ".png": - CreateTestTexture(path); - break; - case ".asset": - CreateTestAsset(path); - break; - } - } + if (File.Exists(path)) + File.Delete(path); + + var ext = Path.GetExtension(path); + switch (ext) + { + case ".png": + CreateTestTexture(path); + break; + case ".txt": + CreateTestAsset(path); + break; + } + var ids = ContentBuildInterface.GetPlayerObjectIdentifiersInAsset(new GUID(AssetDatabase.AssetPathToGUID(path)), EditorUserBuildSettings.activeBuildTarget); return ids.Length == 0 ? default : ids[0]; } - private static void CreateTestAsset(string path) { - Debug.Log($"Creating asset at path {path}"); - var so = ScriptableObject.CreateInstance(); - AssetDatabase.CreateAsset(so, path); + File.WriteAllText(path, "asdf"); + AssetDatabase.ImportAsset(path, ImportAssetOptions.Default); } private static void CreateTestTexture(string path) { - Debug.Log($"Creating texture at path {path}"); var tex = new Texture2D(8, 8); File.WriteAllBytes(path, tex.EncodeToPNG()); - var text = AssetDatabase.LoadAssetAtPath(path); AssetDatabase.ImportAsset(path, ImportAssetOptions.Default); } diff --git a/Unity.Scenes.Editor/Build/RemoteContentCatalogBuildUtility.cs b/Unity.Scenes.Editor/Build/RemoteContentCatalogBuildUtility.cs index 217cc6d5..156912ab 100644 --- a/Unity.Scenes.Editor/Build/RemoteContentCatalogBuildUtility.cs +++ b/Unity.Scenes.Editor/Build/RemoteContentCatalogBuildUtility.cs @@ -36,7 +36,7 @@ static void ContentUpdateMenuItem() if (!string.IsNullOrEmpty(buildFolder)) { var buildTarget = EditorUserBuildSettings.activeBuildTarget; - var tmpBuildFolder = Path.Combine(Path.GetDirectoryName(Application.dataPath), $"/Library/ContentUpdateBuildDir/{PlayerSettings.productName}"); + var tmpBuildFolder = Path.Combine(Path.GetDirectoryName(Application.dataPath), $"Library/ContentUpdateBuildDir/{PlayerSettings.productName}"); var instance = DotsGlobalSettings.Instance; var playerGuid = instance.GetPlayerType() == DotsGlobalSettings.PlayerType.Client ? instance.GetClientGUID() : instance.GetServerGUID(); diff --git a/Unity.Scenes.Editor/EntitySceneBuildUtility.cs b/Unity.Scenes.Editor/EntitySceneBuildUtility.cs index 2df2e955..9aa4299e 100644 --- a/Unity.Scenes.Editor/EntitySceneBuildUtility.cs +++ b/Unity.Scenes.Editor/EntitySceneBuildUtility.cs @@ -274,7 +274,13 @@ the scene section hash is created in order to link the data at runtime. #if ENABLE_CONTENT_BUILD_DIAGNOSTICS Debug.Log($"objIdToRTId {guid}, {lfid}, {path} using path override -> {pathOverrides[path]}"); #endif - return pathOverrides[path]; + if (!pathOverrides.TryGetValue(path, out var overrideId)) + { +#if ENABLE_CONTENT_BUILD_DIAGNOSTICS + Debug.Log($"Path override not found for {path}, skipping."); +#endif + } + return overrideId; } var id = new UntypedWeakReferenceId { GlobalId = new RuntimeGlobalObjectId { AssetGUID = guid, SceneObjectIdentifier0 = lfid }, GenerationType = WeakReferenceGenerationType.UnityObject }; if (!weakAssetRefs.Contains(id)) diff --git a/ValidationExceptions.json b/ValidationExceptions.json index b12d2cd8..21ec0640 100644 --- a/ValidationExceptions.json +++ b/ValidationExceptions.json @@ -1,20 +1,22 @@ { - "ErrorExceptions": [ - { - "ValidationTest": "API Validation", - "ExceptionMessage": "Additions require a new minor or major version.", - "PackageVersion": "1.2.3" - }, - { - "ValidationTest": "API Validation", - "ExceptionMessage": "New assembly \"Unity.Entities.TestComponents\" may only be added in a new minor or major version.", - "PackageVersion": "1.2.3" - }, - { - "ValidationTest": "API Validation", - "ExceptionMessage": "New assembly \"Unity.Scenes.PerformanceTests\" may only be added in a new minor or major version.", - "PackageVersion": "1.2.3" - } - ], - "WarningExceptions": [] + "ErrorExceptions": [ + { + "ValidationTest": "API Validation", + "ExceptionMessage": "Additions require a new minor or major version.", + "PackageVersion": "1.2.4" + }, + + { + "ValidationTest": "API Validation", + "ExceptionMessage": "New assembly \"Unity.Entities.TestComponents\" may only be added in a new minor or major version.", + "PackageVersion": "1.2.4" + }, + + { + "ValidationTest": "API Validation", + "ExceptionMessage": "New assembly \"Unity.Scenes.PerformanceTests\" may only be added in a new minor or major version.", + "PackageVersion": "1.2.4" + } + ], + "WarningExceptions": [] } \ No newline at end of file diff --git a/ValidationExceptions.json.meta b/ValidationExceptions.json.meta index 73b1b201..62b6bcc1 100644 --- a/ValidationExceptions.json.meta +++ b/ValidationExceptions.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0417894edcfb98d48b612319dc5053c8 +guid: 29c9829e774a474479b14c10e0db043d TextScriptImporter: externalObjects: {} userData: diff --git a/package.json b/package.json index 43966909..eb8ed267 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "com.unity.entities", "displayName": "Entities", - "version": "1.2.3", + "version": "1.2.4", "unity": "2022.3", "unityRelease": "11f1", "dependencies": { "com.unity.burst": "1.8.13", "com.unity.serialization": "3.1.1", - "com.unity.collections": "2.4.2", + "com.unity.collections": "2.4.3", "com.unity.mathematics": "1.3.1", "com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.audio": "1.0.0", @@ -25,15 +25,15 @@ "unity" ], "_upm": { - "changelog": "### Fixed\n\n* Queries are now correctly constructed using `EntityQueryBuilder` when using `[WithDisabled(T)]` on `IJobEntity` with `EnabledRefRW` and/or `RefRW`.\n* Cross-world selection in Entities Hierarchy\n* Entities windows do not throw exceptions anymore when installing or removing packages from package manager.\n* Fixed crash on quit in players due to incorrect RuntimeContentManager cleanup timing.\n* respond to much docs feedback\n* Fixed a regression which caused subscene section bounding volumes to be computed incorrectly.\n* `EntityCommandBuffer.AddComponentForLinkedEntityGroup()` and `EntityCommandBuffer.SetComponentForLinkedEntityGroup()` now correctly process all entities that match the provided `EntityQueryMask`, even if new archetypes matching the query were added earlier during command buffer playback.\n* Creating a cycle with `[UpdateInGroup]` attributes now throws an exception instead of crashing the Editor." + "changelog": "* Debug proxies (used by external debuggers) were sometimes using invalid field offsets when inspecting structs in blob assets. This led to incorrect values being reported in debugger watch windows. In particular, this would be triggered by the use of bool fields in blob asset structs.\n* Entity version numbers could go back to 1 after reallocation in some edge cases.\n* When building a content update, a temporary path was getting created in the drive root instead of the Library folder. This would also cause content update builds to grow in size every time they were built. The folder is now created in the Library correctly.\n* Error in build when sprites are contained in subscenes has been removed.\n* Regression in compilation time with assemblies with lots of system methods.\n* EntityComponentStore leaked memory during domain reload." }, "upmCi": { - "footprint": "306c46368bceb20615a5b80dac7cefecb285c2c5" + "footprint": "96605790ff63cd76ba65f23b7fbbf7d1ab878b6a" }, "documentationUrl": "https://docs.unity3d.com/Packages/com.unity.entities@1.2/manual/index.html", "repository": { "url": "https://github.cds.internal.unity3d.com/unity/dots.git", "type": "git", - "revision": "0e866f29be5f7742acc14fad89281f547835ef01" + "revision": "3229c084d74b90980f151fe926f426ae38a63b44" } }