diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Materials/Test.mat b/Examples~/Hybrid Simulation Test Project/Assets/Materials/Scenery.mat similarity index 95% rename from Examples~/Hybrid Simulation Test Project/Assets/Materials/Test.mat rename to Examples~/Hybrid Simulation Test Project/Assets/Materials/Scenery.mat index c6bd1ed..c416a33 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Materials/Test.mat +++ b/Examples~/Hybrid Simulation Test Project/Assets/Materials/Scenery.mat @@ -20,7 +20,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Test + m_Name: Scenery m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3} m_ShaderKeywords: _SPECULAR_COLOR m_LightmapFlags: 4 @@ -118,7 +118,7 @@ Material: - _ReceiveShadows: 1 - _SampleGI: 0 - _Shininess: 0 - - _Smoothness: 0.5 + - _Smoothness: 0.2 - _SmoothnessSource: 0 - _SmoothnessTextureChannel: 0 - _SpecSource: 0 @@ -129,8 +129,8 @@ Material: - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _BaseColor: {r: 0.57844627, g: 0.8301887, b: 0.5208259, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - - _SpecColor: {r: 0.19999978, g: 0.19999978, b: 0.19999978, a: 0.5} + - _SpecColor: {r: 0.19998756, g: 0.19998756, b: 0.19998756, a: 0.2} m_BuildTextureStacks: [] diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Materials/Test.mat.meta b/Examples~/Hybrid Simulation Test Project/Assets/Materials/Scenery.mat.meta similarity index 100% rename from Examples~/Hybrid Simulation Test Project/Assets/Materials/Test.mat.meta rename to Examples~/Hybrid Simulation Test Project/Assets/Materials/Scenery.mat.meta diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Material.mat b/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Material.mat new file mode 100644 index 0000000..e7a1926 --- /dev/null +++ b/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Material.mat @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Test Material + m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossinessSource: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Shininess: 0 + - _Smoothness: 0.5 + - _SmoothnessSource: 0 + - _SmoothnessTextureChannel: 0 + - _SpecSource: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.1999999, g: 0.1999999, b: 0.1999999, a: 0.5} + m_BuildTextureStacks: [] +--- !u!114 &3226815170270220724 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 4 diff --git a/Runtime/Scripts/NativeCollections.meta b/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Material.mat.meta similarity index 54% rename from Runtime/Scripts/NativeCollections.meta rename to Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Material.mat.meta index 5c079d2..987a4c2 100644 --- a/Runtime/Scripts/NativeCollections.meta +++ b/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Material.mat.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: c988ce92e6e197c4e9c5ddd4e0415783 -folderAsset: yes -DefaultImporter: +guid: d2cb46a9820e91f469458fc5bc541f37 +NativeFormatImporter: externalObjects: {} + mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Prefab.prefab b/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Prefab.prefab index 764fabe..be7d909 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Prefab.prefab +++ b/Examples~/Hybrid Simulation Test Project/Assets/Objects/Test/Test Prefab.prefab @@ -60,7 +60,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 10cd3273bb8895845abac9a0a36b2b68, type: 2} + - {fileID: 2100000, guid: d2cb46a9820e91f469458fc5bc541f37, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -94,3 +94,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 375e5906166d43e7adbd77db74139c2c, type: 3} m_Name: m_EditorClassIdentifier: + DestroyMe: 0 diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Render Pipeline/URP Settings.asset b/Examples~/Hybrid Simulation Test Project/Assets/Render Pipeline/URP Settings.asset index 68cb421..a91a4c3 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Render Pipeline/URP Settings.asset +++ b/Examples~/Hybrid Simulation Test Project/Assets/Render Pipeline/URP Settings.asset @@ -23,6 +23,7 @@ MonoBehaviour: m_RequireOpaqueTexture: 0 m_OpaqueDownsampling: 1 m_SupportsTerrainHoles: 0 + m_StoreActionsOptimization: 0 m_SupportsHDR: 0 m_MSAA: 1 m_RenderScale: 1 @@ -33,9 +34,6 @@ MonoBehaviour: m_AdditionalLightsPerObjectLimit: 4 m_AdditionalLightShadowsSupported: 0 m_AdditionalLightsShadowmapResolution: 512 - m_AdditionalLightsShadowResolutionTierLow: 128 - m_AdditionalLightsShadowResolutionTierMedium: 256 - m_AdditionalLightsShadowResolutionTierHigh: 512 m_ShadowDistance: 100 m_ShadowCascadeCount: 4 m_Cascade2Split: 0.25 @@ -51,11 +49,11 @@ MonoBehaviour: m_UseAdaptivePerformance: 1 m_ColorGradingMode: 0 m_ColorGradingLutSize: 32 - m_UseFastSRGBLinearConversion: 0 m_ShadowType: 1 m_LocalShadowsSupported: 0 m_LocalShadowsAtlasResolution: 256 m_MaxPixelLights: 0 m_ShadowAtlasResolution: 256 m_ShaderVariantLogLevel: 0 + m_VolumeFrameworkUpdateMode: 0 m_ShadowCascades: 2 diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Scenes/Example.unity b/Examples~/Hybrid Simulation Test Project/Assets/Scenes/Example.unity index 4096e1a..39d801b 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Scenes/Example.unity +++ b/Examples~/Hybrid Simulation Test Project/Assets/Scenes/Example.unity @@ -497,9 +497,9 @@ MonoBehaviour: _simulationResetSystems: [] _mainSimulationSystems: - {fileID: 11400000, guid: b55916dcf0ef8ed4a9c0aa675f60e447, type: 2} - - {fileID: 11400000, guid: a2c5f951bc7bf904cb32976be936ea2d, type: 2} _presentationPreUpdateSystems: - {fileID: 11400000, guid: e8b4045ab457dba4f8c6c5031b4de4f7, type: 2} + - {fileID: 11400000, guid: a2c5f951bc7bf904cb32976be936ea2d, type: 2} _presentationPostUpdateSystems: [] _endOfFrameSystems: [] EntitiesToGenerate: 2000 @@ -665,7 +665,7 @@ MonoBehaviour: m_VolumeTrigger: {fileID: 0} m_VolumeFrameworkUpdateModeOption: 2 m_RenderPostProcessing: 0 - m_Antialiasing: 1 + m_Antialiasing: 0 m_AntialiasingQuality: 2 m_StopNaN: 0 m_Dithering: 0 diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/10101Software.DOTS.HybridSimulation.TestProject.asmdef b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/10101Software.DOTS.HybridSimulation.TestProject.asmdef index 3dab4f3..3f4e449 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/10101Software.DOTS.HybridSimulation.TestProject.asmdef +++ b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/10101Software.DOTS.HybridSimulation.TestProject.asmdef @@ -5,8 +5,8 @@ "GUID:852fdcd981c08e249a237d901a75e290", "GUID:734d92eba21c94caba915361bd5ac177", "GUID:d8b63aba1907145bea998dd612889d6b", - "GUID:6f70aebd52e2e43498de74bdaa4389ef", - "GUID:e0cd26848372d4e5c891c569017e11f1" + "GUID:e0cd26848372d4e5c891c569017e11f1", + "GUID:2665a8d13d1b3f18800f46e256720795" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ApplyVelocitySystemReference.cs b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ApplyVelocitySystemReference.cs index d15f966..b3343ea 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ApplyVelocitySystemReference.cs +++ b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ApplyVelocitySystemReference.cs @@ -8,7 +8,8 @@ namespace Software10101.DOTS.Example.Systems { [CreateAssetMenu(menuName = "Systems/" + nameof(ApplyVelocitySystem))] public class ApplyVelocitySystemReference : SystemTypeReference { } - public class ApplyVelocitySystem : SystemBase { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 + public partial class ApplyVelocitySystem : SystemBase { protected override void OnUpdate() { float dt = TimeUtil.FixedDeltaTime; diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/PositionPresentationSystemReference.cs b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/PositionPresentationSystemReference.cs index da4d4f3..a46c473 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/PositionPresentationSystemReference.cs +++ b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/PositionPresentationSystemReference.cs @@ -10,7 +10,8 @@ namespace Software10101.DOTS.Example.Systems { [CreateAssetMenu(menuName = "Systems/" + nameof(PositionPresentationSystem))] public class PositionPresentationSystemReference : SystemTypeReference { } - public class PositionPresentationSystem : SystemBase { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 + public partial class PositionPresentationSystem : SystemBase { protected override void OnUpdate() { float presentationFraction = TimeUtil.PresentationTimeFraction; // this is done just once instead of once per instance diff --git a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ShuffleEntitiesExampleReference.cs b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ShuffleEntitiesExampleReference.cs index e0b61b6..0af873b 100644 --- a/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ShuffleEntitiesExampleReference.cs +++ b/Examples~/Hybrid Simulation Test Project/Assets/Scripts/Systems/ShuffleEntitiesExampleReference.cs @@ -10,12 +10,10 @@ namespace Software10101.DOTS.Example.Systems { [CreateAssetMenu(menuName = "Systems/" + nameof(ShuffleEntitiesExampleSystem))] public class ShuffleEntitiesExampleReference : SystemTypeReference { } - public class ShuffleEntitiesExampleSystem : SystemBase { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 + public partial class ShuffleEntitiesExampleSystem : SystemBase { protected override void OnUpdate() { - // encapsulate the random - NativeSingleton random = new NativeSingleton( - new Random(Convert.ToUInt32(new System.Random().Next())), - Allocator.TempJob); + Random r = new Random(Convert.ToUInt32(new System.Random().Next())); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // get entities with position @@ -33,18 +31,13 @@ protected override void OnUpdate() { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Job .WithCode(() => { - Random r = random.GetValue(); - // https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modern_method for (int i = entitiesWithPosition.Length - 1; i >= 1; i--) { int j = r.NextInt(0, i + 1); // max is not inclusive (entitiesWithPosition[i], entitiesWithPosition[j]) = (entitiesWithPosition[j], entitiesWithPosition[i]); } - - random.SetValue(r); }) - .WithDisposeOnCompletion(random) .Schedule(); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -52,11 +45,12 @@ protected override void OnUpdate() { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Job .WithCode(() => { - int length = entitiesWithPosition.Length; - - for (int i = 0; i < length; i++) { - Entity e = entitiesWithPosition[i]; + if (entitiesWithPosition.IsEmpty) { + return; } + + int index = entitiesWithPosition[0].Index; + Debug.Log($"Initial shuffled entity index: {index}"); }) .WithDisposeOnCompletion(entitiesWithPosition) .Schedule(); diff --git a/Examples~/Hybrid Simulation Test Project/Packages/packages-lock.json b/Examples~/Hybrid Simulation Test Project/Packages/packages-lock.json index b4655fd..97c1c48 100644 --- a/Examples~/Hybrid Simulation Test Project/Packages/packages-lock.json +++ b/Examples~/Hybrid Simulation Test Project/Packages/packages-lock.json @@ -5,11 +5,11 @@ "depth": 0, "source": "local", "dependencies": { - "com.unity.entities": "0.17.0-preview.42" + "com.unity.entities": "0.50.0-preview.24" } }, "com.unity.burst": { - "version": "1.4.1", + "version": "1.6.4", "depth": 2, "source": "registry", "dependencies": { @@ -18,31 +18,35 @@ "url": "https://packages.unity.com" }, "com.unity.collections": { - "version": "0.15.0-preview.21", + "version": "1.2.3-pre.1", "depth": 2, "source": "registry", "dependencies": { - "com.unity.test-framework.performance": "2.3.1-preview", - "com.unity.burst": "1.4.1" + "com.unity.burst": "1.6.4", + "com.unity.test-framework": "1.1.31" }, "url": "https://packages.unity.com" }, "com.unity.entities": { - "version": "0.17.0-preview.42", + "version": "0.50.0-preview.24", "depth": 1, "source": "registry", "dependencies": { - "com.unity.burst": "1.4.1", - "com.unity.properties": "1.5.0-preview", - "com.unity.serialization": "1.5.0-preview", - "com.unity.collections": "0.15.0-preview.21", - "com.unity.mathematics": "1.2.1", + "com.unity.burst": "1.6.4", + "com.unity.properties": "1.7.0-preview", + "com.unity.properties.ui": "1.7.0-preview", + "com.unity.serialization": "1.7.0-preview.1", + "com.unity.collections": "1.2.3-pre.1", + "com.unity.mathematics": "1.2.5", "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", "com.unity.test-framework.performance": "2.3.1-preview", - "com.unity.nuget.mono-cecil": "0.1.6-preview.2", - "com.unity.jobs": "0.8.0-preview.23", - "com.unity.scriptablebuildpipeline": "1.9.0", - "com.unity.platforms": "0.10.0-preview.10" + "com.unity.nuget.mono-cecil": "1.10.1", + "com.unity.jobs": "0.50.0-preview.8", + "com.unity.scriptablebuildpipeline": "1.19.2", + "com.unity.platforms": "0.50.0-preview.4", + "com.unity.roslyn": "0.2.1-preview", + "com.unity.profiling.core": "1.0.0" }, "url": "https://packages.unity.com" }, @@ -88,29 +92,29 @@ "url": "https://packages.unity.com" }, "com.unity.jobs": { - "version": "0.8.0-preview.23", + "version": "0.50.0-preview.8", "depth": 2, "source": "registry", "dependencies": { - "com.unity.collections": "0.15.0-preview.21", - "com.unity.mathematics": "1.2.1" + "com.unity.burst": "1.6.4", + "com.unity.collections": "1.2.3-pre.1", + "com.unity.mathematics": "1.2.1", + "com.unity.nuget.mono-cecil": "1.10.1" }, "url": "https://packages.unity.com" }, "com.unity.mathematics": { - "version": "1.2.1", + "version": "1.2.5", "depth": 2, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, "com.unity.nuget.mono-cecil": { - "version": "0.1.6-preview.2", + "version": "1.10.1", "depth": 2, "source": "registry", - "dependencies": { - "nuget.mono-cecil": "0.1.6-preview" - }, + "dependencies": {}, "url": "https://packages.unity.com" }, "com.unity.nuget.newtonsoft-json": { @@ -121,20 +125,27 @@ "url": "https://packages.unity.com" }, "com.unity.platforms": { - "version": "0.10.0-preview.10", + "version": "0.50.0-preview.4", "depth": 2, "source": "registry", "dependencies": { - "com.unity.properties": "1.6.0-preview", - "com.unity.properties.ui": "1.6.2-preview.1", - "com.unity.scriptablebuildpipeline": "1.6.4-preview", - "com.unity.serialization": "1.6.2-preview" + "com.unity.properties": "1.7.0-preview", + "com.unity.properties.ui": "1.7.0-preview", + "com.unity.scriptablebuildpipeline": "1.19.2", + "com.unity.serialization": "1.7.0-preview.1" }, "url": "https://packages.unity.com" }, + "com.unity.profiling.core": { + "version": "1.0.0", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.properties": { - "version": "1.6.0-preview", - "depth": 3, + "version": "1.7.0-preview", + "depth": 2, "source": "registry", "dependencies": { "com.unity.nuget.mono-cecil": "0.1.6-preview.2", @@ -143,13 +154,14 @@ "url": "https://packages.unity.com" }, "com.unity.properties.ui": { - "version": "1.6.2-preview.1", - "depth": 3, + "version": "1.7.0-preview", + "depth": 2, "source": "registry", "dependencies": { - "com.unity.properties": "1.6.0-preview", - "com.unity.serialization": "1.6.1-preview", - "com.unity.modules.uielements": "1.0.0" + "com.unity.properties": "1.7.0-preview", + "com.unity.serialization": "1.7.0-preview.1", + "com.unity.modules.uielements": "1.0.0", + "com.unity.test-framework.performance": "2.3.1-preview" }, "url": "https://packages.unity.com" }, @@ -175,8 +187,15 @@ }, "url": "https://packages.unity.com" }, + "com.unity.roslyn": { + "version": "0.2.1-preview", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.scriptablebuildpipeline": { - "version": "1.9.0", + "version": "1.19.2", "depth": 2, "source": "registry", "dependencies": {}, @@ -190,14 +209,14 @@ "url": "https://packages.unity.com" }, "com.unity.serialization": { - "version": "1.6.2-preview", - "depth": 3, + "version": "1.7.0-preview.1", + "depth": 2, "source": "registry", "dependencies": { "com.unity.collections": "0.12.0-preview.13", "com.unity.burst": "1.3.5", "com.unity.jobs": "0.5.0-preview.14", - "com.unity.properties": "1.6.0-preview", + "com.unity.properties": "1.7.0-preview", "com.unity.test-framework.performance": "2.3.1-preview" }, "url": "https://packages.unity.com" @@ -213,7 +232,7 @@ "url": "https://packages.unity.com" }, "com.unity.test-framework": { - "version": "1.1.29", + "version": "1.1.31", "depth": 1, "source": "registry", "dependencies": { @@ -242,13 +261,6 @@ "com.unity.modules.imgui": "1.0.0" } }, - "nuget.mono-cecil": { - "version": "0.1.6-preview", - "depth": 3, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, "com.unity.modules.animation": { "version": "1.0.0", "depth": 0, @@ -311,6 +323,12 @@ "com.unity.modules.imgui": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0" } + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 2, + "source": "builtin", + "dependencies": {} } } } diff --git a/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectSettings.asset b/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectSettings.asset index ad50877..64ca79a 100644 --- a/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectSettings.asset +++ b/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectSettings.asset @@ -153,7 +153,7 @@ PlayerSettings: androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: - Standalone: com.10101Software.HybridSimulationTestProject + Standalone: com.10101-Software.Hybrid-Simulation-Test-Project buildNumber: Standalone: 0 iPhone: 0 @@ -270,7 +270,7 @@ PlayerSettings: m_BuildTargetPlatformIcons: [] m_BuildTargetBatching: - m_BuildTarget: Standalone - m_StaticBatching: 1 + m_StaticBatching: 0 m_DynamicBatching: 0 - m_BuildTarget: tvOS m_StaticBatching: 1 @@ -503,7 +503,9 @@ PlayerSettings: switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 switchUseMicroSleepForYield: 1 + switchEnableRamDiskSupport: 0 switchMicroSleepForYieldTime: 25 + switchRamDiskSpaceSize: 12 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: @@ -646,6 +648,7 @@ PlayerSettings: metroFTAName: metroFTAFileTypes: [] metroProtocolName: + vcxProjDefaultLanguage: XboxOneProductId: XboxOneUpdateKey: XboxOneSandboxId: diff --git a/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectVersion.txt b/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectVersion.txt index 14a36b8..bc68a12 100644 --- a/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectVersion.txt +++ b/Examples~/Hybrid Simulation Test Project/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.30f1 -m_EditorVersionWithRevision: 2020.3.30f1 (1fb1bf06830e) +m_EditorVersion: 2020.3.32f1 +m_EditorVersionWithRevision: 2020.3.32f1 (12f8b0834f07) diff --git a/Runtime/Scripts/MonoBehaviours/Bootstrapper.cs b/Runtime/Scripts/MonoBehaviours/Bootstrapper.cs index 0d44465..7081c2b 100644 --- a/Runtime/Scripts/MonoBehaviours/Bootstrapper.cs +++ b/Runtime/Scripts/MonoBehaviours/Bootstrapper.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Software10101.DOTS.Archetypes; using Software10101.DOTS.Data; using Software10101.DOTS.Systems; @@ -8,8 +9,6 @@ using UnityEngine; using UnityEngine.PlayerLoop; using UnityEngine.Serialization; -using PresentationSystemGroup = Software10101.DOTS.Systems.Groups.PresentationSystemGroup; -using SimulationSystemGroup = Software10101.DOTS.Systems.Groups.SimulationSystemGroup; namespace Software10101.DOTS.MonoBehaviours { /// @@ -41,27 +40,31 @@ public class Bootstrapper : WorldBehaviour { [Tooltip("Systems that execute before each simulation tick. (executed 0-n times per frame)")] [SerializeField] - private SystemTypeReference[] _simulationResetSystems = new SystemTypeReference[0]; + private SystemTypeReference[] _simulationResetSystems = Array.Empty(); [Tooltip("Systems that execute during each simulation tick. (executed 0-n times per frame)")] [FormerlySerializedAs("_simulationSystems")] [SerializeField] - private SystemTypeReference[] _mainSimulationSystems = new SystemTypeReference[0]; + private SystemTypeReference[] _mainSimulationSystems = Array.Empty(); [Tooltip("Systems that execute before the ManagedMonoBehaviours. (executed once per frame)")] [FormerlySerializedAs("_presentationSystems")] [SerializeField] - private SystemTypeReference[] _presentationPreUpdateSystems = new SystemTypeReference[0]; + private SystemTypeReference[] _presentationPreUpdateSystems = Array.Empty(); [Tooltip("Systems that execute after the ManagedMonoBehaviours. (executed once per frame)")] [SerializeField] - private SystemTypeReference[] _presentationPostUpdateSystems = new SystemTypeReference[0]; + private SystemTypeReference[] _presentationPostUpdateSystems = Array.Empty(); [Tooltip("Systems that execute at the end of each frame. Useful for systems that serialize the world. (executed once per frame)")] [SerializeField] - private SystemTypeReference[] _endOfFrameSystems = new SystemTypeReference[0]; + private SystemTypeReference[] _endOfFrameSystems = Array.Empty(); protected virtual void Start() { + // set up initialization group + // ReSharper disable once UnusedVariable // not used by the bootstrapper but is one of Unity's root system groups + InitializationSystemGroup initGroup = AddSystem(typeof(Initialization), new InitializationSystemGroup()); + // set up simulation systems SimulationSystemGroup simGroup = AddSystem(typeof(FixedUpdate), new SimulationSystemGroup()); { diff --git a/Runtime/Scripts/NativeCollections/10101Software.DOTS.HybridSimulation.NativeCollections.asmdef b/Runtime/Scripts/NativeCollections/10101Software.DOTS.HybridSimulation.NativeCollections.asmdef deleted file mode 100644 index 3e851a0..0000000 --- a/Runtime/Scripts/NativeCollections/10101Software.DOTS.HybridSimulation.NativeCollections.asmdef +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "10101Software.DOTS.HybridSimulation.NativeCollections", - "rootNamespace": "", - "references": [ - "GUID:e0cd26848372d4e5c891c569017e11f1", - "GUID:2665a8d13d1b3f18800f46e256720795" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": true, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Runtime/Scripts/NativeCollections/10101Software.DOTS.HybridSimulation.NativeCollections.asmdef.meta b/Runtime/Scripts/NativeCollections/10101Software.DOTS.HybridSimulation.NativeCollections.asmdef.meta deleted file mode 100644 index 89fc89a..0000000 --- a/Runtime/Scripts/NativeCollections/10101Software.DOTS.HybridSimulation.NativeCollections.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6f70aebd52e2e43498de74bdaa4389ef -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Scripts/NativeCollections/NativeSingleton.cs b/Runtime/Scripts/NativeCollections/NativeSingleton.cs deleted file mode 100644 index b26f2ac..0000000 --- a/Runtime/Scripts/NativeCollections/NativeSingleton.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using Unity.Burst; -using Unity.Collections.LowLevel.Unsafe; -using Unity.Jobs; - -// ReSharper disable InconsistentNaming - -namespace Unity.Collections -{ - public interface INativeReadOnlySingleton where T : struct { - T GetValue(); - } - - /// - /// Structured very similarly to NativeList but it only stores one element. - /// - [StructLayout(LayoutKind.Sequential)] - [NativeContainer] - [DebuggerTypeProxy(typeof(NativeSingletonDebugView<>))] - [BurstCompatible(GenericTypeArguments = new [] { typeof(int) })] - public unsafe struct NativeSingleton - : INativeDisposable - , INativeReadOnlySingleton - where T : struct - { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - internal AtomicSafetyHandle m_Safety; - static readonly SharedStatic s_staticSafetyId = SharedStatic.GetOrCreate>(); - - [BurstDiscard] - static void CreateStaticSafetyId() - { - s_staticSafetyId.Data = AtomicSafetyHandle.NewStaticSafetyId>(); - } - - [NativeSetClassTypeToNullOnSchedule] - DisposeSentinel m_DisposeSentinel; -#endif - [NativeDisableUnsafePtrRestriction] - internal UnsafeList* m_ListData; - - public NativeSingleton(T value, Allocator allocator) - { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - CheckAllocator(allocator); - // CollectionHelper.CheckIsUnmanaged(); - - DisposeSentinel.Create(out m_Safety, out m_DisposeSentinel, 2, allocator); - if (s_staticSafetyId.Data == 0) - { - CreateStaticSafetyId(); - } - AtomicSafetyHandle.SetStaticSafetyId(ref m_Safety, s_staticSafetyId.Data); -#endif - m_ListData = UnsafeList.Create(UnsafeUtility.SizeOf(), UnsafeUtility.AlignOf(), 1, allocator); - -#if ENABLE_UNITY_COLLECTIONS_CHECKS - AtomicSafetyHandle.SetBumpSecondaryVersionOnScheduleWrite(m_Safety, true); -#endif - -#if ENABLE_UNITY_COLLECTIONS_CHECKS - AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); -#endif - UnsafeUtility.WriteArrayElement(m_ListData->Ptr, 0, value); - } - - public T GetValue() { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); -#endif - return UnsafeUtility.ReadArrayElement(m_ListData->Ptr, 0); - } - - public void SetValue(T value) { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); -#endif - UnsafeUtility.WriteArrayElement(m_ListData->Ptr, 0, value); - } - - /// - /// Reports whether memory for the container is allocated. - /// - /// True if this container object's internal storage has been allocated. - /// - /// Note that the container storage is not created if you use the default constructor. You must specify - /// at least an allocation type to construct a usable container. - /// - /// *Warning:* the `IsCreated` property can't be used to determine whether a copy of a container is still valid. - /// If you dispose any copy of the container, the container storage is deallocated. However, the properties of - /// the other copies of the container (including the original) are not updated. As a result the `IsCreated` property - /// of the copies still return `true` even though the container storage has been deallocated. - /// Accessing the data of a native container that has been disposed throws a exception. - /// - public bool IsCreated => m_ListData != null; - - /// - /// Disposes of this container and deallocates its memory immediately. - /// - public void Dispose() - { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - DisposeSentinel.Dispose(ref m_Safety, ref m_DisposeSentinel); -#endif - UnsafeList.Destroy(m_ListData); - m_ListData = null; - } - - /// - /// Safely disposes of this container and deallocates its memory when the jobs that use it have completed. - /// - /// You can call this function dispose of the container immediately after scheduling the job. Pass - /// the [JobHandle](https://docs.unity3d.com/ScriptReference/Unity.Jobs.JobHandle.html) returned by - /// the [Job.Schedule](https://docs.unity3d.com/ScriptReference/Unity.Jobs.IJobExtensions.Schedule.html) - /// method using the `jobHandle` parameter so the job scheduler can dispose the container after all jobs - /// using it have run. - /// The job handle or handles for any scheduled jobs that use this container. - /// A new job handle containing the prior handles as well as the handle for the job that deletes - /// the container. - [BurstCompatible(RequiredUnityDefine = "UNITY_2020_2_OR_NEWER") /* Due to job scheduling on 2020.1 using statics */] - public JobHandle Dispose(JobHandle inputDeps) - { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - // [DeallocateOnJobCompletion] is not supported, but we want the deallocation - // to happen in a thread. DisposeSentinel needs to be cleared on main thread. - // AtomicSafetyHandle can be destroyed after the job was scheduled (Job scheduling - // will check that no jobs are writing to the container). - DisposeSentinel.Clear(ref m_DisposeSentinel); - - var jobHandle = new NativeSingletonDisposeJob { Data = new NativeSingletonDispose { m_ListData = m_ListData, m_Safety = m_Safety } }.Schedule(inputDeps); - - AtomicSafetyHandle.Release(m_Safety); -#else - var jobHandle = new NativeSingletonDisposeJob { Data = new NativeListDispose { m_ListData = m_ListData } }.Schedule(inputDeps); -#endif - m_ListData = null; - - return jobHandle; - } - - private NativeArray AsArray() - { -#if ENABLE_UNITY_COLLECTIONS_CHECKS - AtomicSafetyHandle.CheckGetSecondaryDataPointerAndThrow(m_Safety); - var arraySafety = m_Safety; - AtomicSafetyHandle.UseSecondaryVersion(ref arraySafety); -#endif - var array = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray(m_ListData->Ptr, m_ListData->Length, Allocator.None); - -#if ENABLE_UNITY_COLLECTIONS_CHECKS - NativeArrayUnsafeUtility.SetAtomicSafetyHandle(ref array, arraySafety); -#endif - return array; - } - - [NotBurstCompatible] - internal T[] ToArray() - { - return AsArray().ToArray(); - } - - [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")] - static void CheckAllocator(Allocator allocator) - { - // Native allocation is only valid for Temp, Job and Persistent. - if (allocator <= Allocator.None) - throw new ArgumentException("Allocator must be Temp, TempJob or Persistent", nameof(allocator)); - } - } - - [NativeContainer] - [BurstCompatible] - internal unsafe struct NativeSingletonDispose - { - [NativeDisableUnsafePtrRestriction] - public UnsafeList* m_ListData; - -#if ENABLE_UNITY_COLLECTIONS_CHECKS - internal AtomicSafetyHandle m_Safety; -#endif - - public void Dispose() - { - UnsafeList.Destroy(m_ListData); - } - } - - [BurstCompile] - [BurstCompatible] - internal unsafe struct NativeSingletonDisposeJob : IJob - { - internal NativeSingletonDispose Data; - - public void Execute() - { - Data.Dispose(); - } - } - - sealed class NativeSingletonDebugView where T : struct - { - NativeSingleton m_Array; - - public NativeSingletonDebugView(NativeSingleton array) - { - m_Array = array; - } - - public T[] Items => m_Array.ToArray(); - } -} diff --git a/Runtime/Scripts/NativeCollections/NativeSingleton.cs.meta b/Runtime/Scripts/NativeCollections/NativeSingleton.cs.meta deleted file mode 100644 index 479afa2..0000000 --- a/Runtime/Scripts/NativeCollections/NativeSingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 79a4c548f092d0549b8c0f82868e7b39 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Scripts/Systems/Groups/ListComponentSystemGroup.cs b/Runtime/Scripts/Systems/Groups/ListComponentSystemGroup.cs index ef84e27..38bf7ee 100644 --- a/Runtime/Scripts/Systems/Groups/ListComponentSystemGroup.cs +++ b/Runtime/Scripts/Systems/Groups/ListComponentSystemGroup.cs @@ -95,10 +95,10 @@ protected override void OnUpdate() { #endregion } - if (FixedRateManager == null) { + if (RateManager == null) { UpdateAllSystems(); } else { - while (FixedRateManager.ShouldGroupUpdate(this)) { + while (RateManager.ShouldGroupUpdate(this)) { UpdateAllSystems(); } } diff --git a/Runtime/Scripts/Systems/Groups/PresentationSystemGroup.cs b/Runtime/Scripts/Systems/Groups/PresentationSystemGroup.cs deleted file mode 100644 index a866c70..0000000 --- a/Runtime/Scripts/Systems/Groups/PresentationSystemGroup.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Software10101.DOTS.Systems.Groups { - internal sealed class PresentationSystemGroup : ListComponentSystemGroup { } -} diff --git a/Runtime/Scripts/Systems/Groups/PresentationSystemGroup.cs.meta b/Runtime/Scripts/Systems/Groups/PresentationSystemGroup.cs.meta deleted file mode 100644 index 70a81bf..0000000 --- a/Runtime/Scripts/Systems/Groups/PresentationSystemGroup.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 600420c19929406a9e6486f586d05d07 -timeCreated: 1586789628 \ No newline at end of file diff --git a/Runtime/Scripts/Systems/Groups/SimulationSystemGroup.cs b/Runtime/Scripts/Systems/Groups/SimulationSystemGroup.cs deleted file mode 100644 index 0783d93..0000000 --- a/Runtime/Scripts/Systems/Groups/SimulationSystemGroup.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Software10101.DOTS.Systems.Groups { - internal sealed class SimulationSystemGroup : ListComponentSystemGroup { } -} diff --git a/Runtime/Scripts/Systems/Groups/SimulationSystemGroup.cs.meta b/Runtime/Scripts/Systems/Groups/SimulationSystemGroup.cs.meta deleted file mode 100644 index 3f897a0..0000000 --- a/Runtime/Scripts/Systems/Groups/SimulationSystemGroup.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9fd08765c5554cbdae695587a2602a08 -timeCreated: 1586724578 \ No newline at end of file diff --git a/Runtime/Scripts/Systems/ManagedMonoBehaviourUpdateSystem.cs b/Runtime/Scripts/Systems/ManagedMonoBehaviourUpdateSystem.cs index 08b5bba..b2460ae 100644 --- a/Runtime/Scripts/Systems/ManagedMonoBehaviourUpdateSystem.cs +++ b/Runtime/Scripts/Systems/ManagedMonoBehaviourUpdateSystem.cs @@ -5,7 +5,8 @@ using Unity.Jobs; namespace Software10101.DOTS.Systems { - internal sealed class ManagedMonoBehaviourUpdateSystem : SystemBase { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 + internal partial class ManagedMonoBehaviourUpdateSystem : SystemBase { protected override void OnUpdate() { JobHandleExtensions.CompleteJobList(); ManagedMonoBehaviour.DoUpdate(); diff --git a/Runtime/Scripts/Systems/PrefabSpawnSystem.cs b/Runtime/Scripts/Systems/PrefabSpawnSystem.cs index 0afc967..5d85a42 100644 --- a/Runtime/Scripts/Systems/PrefabSpawnSystem.cs +++ b/Runtime/Scripts/Systems/PrefabSpawnSystem.cs @@ -5,8 +5,9 @@ using UnityEngine; namespace Software10101.DOTS.Systems { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 [DisableAutoCreation] - internal sealed class PrefabSpawnSystem : SystemBase { + internal partial class PrefabSpawnSystem : SystemBase { private readonly Bootstrapper _bootstrapper; public PrefabSpawnSystem(Bootstrapper bootstrapper) { diff --git a/Runtime/Scripts/Systems/PresentationDestroySystem.cs b/Runtime/Scripts/Systems/PresentationDestroySystem.cs index 3f853ab..ee39cf2 100644 --- a/Runtime/Scripts/Systems/PresentationDestroySystem.cs +++ b/Runtime/Scripts/Systems/PresentationDestroySystem.cs @@ -3,7 +3,8 @@ using Unity.Entities; namespace Software10101.DOTS.Systems { - internal sealed class PresentationDestroySystem : SystemBase { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 + internal partial class PresentationDestroySystem : SystemBase { protected override void OnUpdate() { Entities .WithoutBurst() diff --git a/Runtime/Scripts/Systems/SimulationDestroySystem.cs b/Runtime/Scripts/Systems/SimulationDestroySystem.cs index 9165adf..d0a9ff2 100644 --- a/Runtime/Scripts/Systems/SimulationDestroySystem.cs +++ b/Runtime/Scripts/Systems/SimulationDestroySystem.cs @@ -2,7 +2,8 @@ using Unity.Entities; namespace Software10101.DOTS.Systems { - internal sealed class SimulationDestroySystem : SystemBase { + // ReSharper disable once PartialTypeWithSinglePart // systems need to be partial after Entities 0.50 + internal partial class SimulationDestroySystem : SystemBase { protected override void OnUpdate() { Entities .WithAll() diff --git a/Runtime/Scripts/Utils/DotsUtil.cs b/Runtime/Scripts/Utils/DotsUtil.cs index 482e12f..901e73e 100644 --- a/Runtime/Scripts/Utils/DotsUtil.cs +++ b/Runtime/Scripts/Utils/DotsUtil.cs @@ -1,5 +1,4 @@ using Software10101.DOTS.MonoBehaviours; -using Unity.Collections; using Unity.Entities; using UnityEngine; @@ -9,8 +8,6 @@ public static class DotsUtil { public static void Reset() { World.DisposeAllWorlds(); - WordStorage.Clear(); - PlayerLoopUtil.ResetPlayerLoop(); ReferenceTypeUtil.Clear(); diff --git a/package.json b/package.json index d4722fe..fc3e53b 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "com.10101software.dots.hybridsimulation", "description": "A framework for using FixedUpdate in a simulation world which is linked to a GameObject-based presentation layer.", - "version": "0.8.0", + "version": "0.9.0", "unity": "2020.3", "displayName": "DOTS Hybrid Simulation Worlds", "dependencies": { - "com.unity.entities": "0.17.0-preview.42" + "com.unity.entities": "0.50.0-preview.24" }, "repository": { "type": "git",