From e3f449f183288d066be2e84429d50e91e0151fb8 Mon Sep 17 00:00:00 2001 From: abenmonkey Date: Sun, 13 Nov 2022 02:16:19 +0800 Subject: [PATCH] update framework --- .gitignore | 1 + Assets/Scenes/SampleScene.unity | 583 ++++++++++-------- Assets/Scripts/EntityData.cs | 13 + Assets/Scripts/Game.Test.asmdef | 18 + .../Scripts/Game.Test.asmdef.meta | 2 +- Assets/Scripts/Main.cs | 3 +- Assets/Scripts/TestEntityDataBlock.cs | 22 + Assets/Scripts/TestEntityDataBlock.cs.meta | 3 + LocalPackages/com.nimin.lowlevel/Runtime.meta | 8 + .../Runtime/StructUtility.cs | 21 + .../Runtime/StructUtility.cs.meta | 3 + .../Runtime/nimin.lowlevel.asmdef} | 2 +- .../Runtime/nimin.lowlevel.asmdef.meta | 7 + LocalPackages/com.nimin.lowlevel/package.json | 15 + .../com.nimin.lowlevel/package.json.meta | 7 + .../com.nimin.tinyecs/Runtime/ComponentId.cs | 25 + .../Runtime/ComponentId.cs.meta | 11 + .../com.nimin.tinyecs/Runtime/Entity.cs | 34 +- .../Runtime/EntityDataBlock.cs | 201 ++++++ .../Runtime/EntityDataBlock.cs.meta | 3 + .../Runtime/EntityDataBlock.gen.cs | 45 ++ .../Runtime/EntityDataBlock.gen.cs.meta | 3 + .../Runtime/EntityDataSet.cs | 14 + .../Runtime/EntityDataSet.cs.meta | 11 + .../Runtime/nimin.tinyecs.asmdef | 34 + .../Runtime/nimin.tinyecs.asmdef.meta | 7 + LocalPackages/com.nimin.tinyecs/package.json | 10 +- Packages/manifest.json | 1 + Packages/packages-lock.json | 12 +- ProjectSettings/ProjectSettings.asset | 5 +- ProjectSettings/SceneTemplateSettings.json | 167 +++++ 31 files changed, 984 insertions(+), 307 deletions(-) create mode 100644 Assets/Scripts/Game.Test.asmdef rename LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef.meta => Assets/Scripts/Game.Test.asmdef.meta (76%) create mode 100644 Assets/Scripts/TestEntityDataBlock.cs create mode 100644 Assets/Scripts/TestEntityDataBlock.cs.meta create mode 100644 LocalPackages/com.nimin.lowlevel/Runtime.meta create mode 100644 LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs create mode 100644 LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs.meta rename LocalPackages/{com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef => com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef} (95%) create mode 100644 LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef.meta create mode 100644 LocalPackages/com.nimin.lowlevel/package.json create mode 100644 LocalPackages/com.nimin.lowlevel/package.json.meta create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs.meta create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs.meta create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs.meta create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs.meta create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef create mode 100644 LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef.meta create mode 100644 ProjectSettings/SceneTemplateSettings.json diff --git a/.gitignore b/.gitignore index 84d6403..c803fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /UserSettings/ .vs/ +.idea/ *.csproj *.unityproj *.sln \ No newline at end of file diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index c39e581..ec2ef9a 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -1,267 +1,316 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -OcclusionCullingSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 - m_SceneGUID: 00000000000000000000000000000000 - m_OcclusionCullingData: {fileID: 0} ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 9 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} - m_UseRadianceAmbientProbe: 0 ---- !u!157 &3 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 12 - m_GIWorkflowMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_LightmapEditorSettings: - serializedVersion: 12 - m_Resolution: 2 - m_BakeResolution: 40 - m_AtlasSize: 1024 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_ExtractAmbientOcclusion: 0 - m_Padding: 2 - m_LightmapParameters: {fileID: 0} - m_LightmapsBakeMode: 1 - m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherFiltering: 1 - m_FinalGatherRayCount: 256 - m_ReflectionCompression: 2 - m_MixedBakeMode: 2 - m_BakeBackend: 1 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 500 - m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 500 - m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 2 - m_PVRDenoiserTypeDirect: 0 - m_PVRDenoiserTypeIndirect: 0 - m_PVRDenoiserTypeAO: 0 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 0 - m_PVRCulling: 1 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 0} - m_LightingSettings: {fileID: 0} ---- !u!196 &4 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - manualTileSize: 0 - tileSize: 256 - accuratePlacement: 0 - debug: - m_Flags: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &705507993 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 705507995} - - component: {fileID: 705507994} - m_Layer: 0 - m_Name: Directional Light - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!108 &705507994 -Light: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 705507993} - m_Enabled: 1 - serializedVersion: 8 - m_Type: 1 - m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} - m_Intensity: 1 - m_Range: 10 - m_SpotAngle: 30 - m_CookieSize: 10 - m_Shadows: - m_Type: 2 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 1 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_Lightmapping: 1 - m_LightShadowCasterMode: 0 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ColorTemperature: 6570 - m_UseColorTemperature: 0 - m_ShadowRadius: 0 - m_ShadowAngle: 0 ---- !u!4 &705507995 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 705507993} - m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} - m_LocalPosition: {x: 0, y: 3, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &963194225 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 963194228} - - component: {fileID: 963194227} - - component: {fileID: 963194226} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &963194226 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 963194225} - m_Enabled: 1 ---- !u!20 &963194227 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 963194225} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_GateFitMode: 2 - m_FocalLength: 50 - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &963194228 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 963194225} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -10} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 705507994} + m_IndirectSpecularColor: {r: 0.44657815, g: 0.49641192, b: 0.57481617, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &705507993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 705507995} + - component: {fileID: 705507994} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &705507994 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.802082 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 1 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &705507995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &963194225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963194228} + - component: {fileID: 963194227} + - component: {fileID: 963194226} + - component: {fileID: 963194229} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &963194226 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 +--- !u!20 &963194227 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &963194228 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &963194229 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 694d8256118344eb2b130fceb1a11b7f, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Scripts/EntityData.cs b/Assets/Scripts/EntityData.cs index da5f092..df120be 100644 --- a/Assets/Scripts/EntityData.cs +++ b/Assets/Scripts/EntityData.cs @@ -1,7 +1,20 @@ using GameCore.TinyECS; +using Unity.Mathematics; namespace GameCore.Test { using Entity = Entity; + public struct TransformData + { + public float3 position; + public float scale; + public quaternion rotation; + } + + public struct StateData + { + public bool death; + public int hp; + } } \ No newline at end of file diff --git a/Assets/Scripts/Game.Test.asmdef b/Assets/Scripts/Game.Test.asmdef new file mode 100644 index 0000000..ba20cde --- /dev/null +++ b/Assets/Scripts/Game.Test.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Game.Test", + "rootNamespace": "", + "references": [ + "nimin.tinyecs", + "Unity.Mathematics", + "Unity.Burst" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef.meta b/Assets/Scripts/Game.Test.asmdef.meta similarity index 76% rename from LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef.meta rename to Assets/Scripts/Game.Test.asmdef.meta index 168c675..7ffb0a8 100644 --- a/LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef.meta +++ b/Assets/Scripts/Game.Test.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c2bd585c8e44341079d076e23cd9d3eb +guid: 21d33bf0450d14e5289fe083b8566dbe AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Assets/Scripts/Main.cs b/Assets/Scripts/Main.cs index 7c40c02..69b4e9e 100644 --- a/Assets/Scripts/Main.cs +++ b/Assets/Scripts/Main.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using GameCore.Test; using UnityEngine; public class Main : MonoBehaviour @@ -7,7 +8,7 @@ public class Main : MonoBehaviour // Start is called before the first frame update void Start() { - + TestEntityDataBlock.Run(); } // Update is called once per frame diff --git a/Assets/Scripts/TestEntityDataBlock.cs b/Assets/Scripts/TestEntityDataBlock.cs new file mode 100644 index 0000000..b5bb93a --- /dev/null +++ b/Assets/Scripts/TestEntityDataBlock.cs @@ -0,0 +1,22 @@ +using GameCore.TinyECS; +using UnityEngine; + +namespace GameCore.Test +{ + public static class TestEntityDataBlock + { + public static void Run() + { + var meta = EntityDataBlockMeta.Create(); + using var blockChain = new EntityDataBlockChain(meta, 1000); + + blockChain.Add(); + ref var stateData = ref blockChain.GetData(0); + stateData.hp = 1000; + + var view = blockChain.AsBlockView(0); + var hp = view.GetData(0).hp; + Debug.LogError($"hp: {hp}"); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/TestEntityDataBlock.cs.meta b/Assets/Scripts/TestEntityDataBlock.cs.meta new file mode 100644 index 0000000..75e338f --- /dev/null +++ b/Assets/Scripts/TestEntityDataBlock.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e5d058ca04eb44268eb93d1871dd132c +timeCreated: 1668273920 \ No newline at end of file diff --git a/LocalPackages/com.nimin.lowlevel/Runtime.meta b/LocalPackages/com.nimin.lowlevel/Runtime.meta new file mode 100644 index 0000000..ebd7bba --- /dev/null +++ b/LocalPackages/com.nimin.lowlevel/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3bcdf9c0cafed4d93834eace6041330f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs b/LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs new file mode 100644 index 0000000..d35b058 --- /dev/null +++ b/LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs @@ -0,0 +1,21 @@ +using Unity.Collections.LowLevel.Unsafe; + +namespace GameCore.LowLevel +{ + public static class StructUtility + { + public static int OffsetOf() + where T : struct + where F : struct + { + var fields = typeof(T).GetFields(); + foreach (var f in fields) + { + if (f.DeclaringType == typeof(F)) + return UnsafeUtility.GetFieldOffset(f); + } + + return -1; + } + } +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs.meta b/LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs.meta new file mode 100644 index 0000000..77bd173 --- /dev/null +++ b/LocalPackages/com.nimin.lowlevel/Runtime/StructUtility.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fde8ecf3379244d6885eb6d4ca9d8d31 +timeCreated: 1668240297 \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef b/LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef similarity index 95% rename from LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef rename to LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef index 707d11e..2ea2e9f 100644 --- a/LocalPackages/com.nimin.tinyecs/Runtime/TinyECS.Runtime.asmdef +++ b/LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef @@ -1,5 +1,5 @@ { - "name": "TinyECS.Runtime", + "name": "nimin.lowlevel", "rootNamespace": "", "references": [ "Unity.Collections", diff --git a/LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef.meta b/LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef.meta new file mode 100644 index 0000000..4bf3336 --- /dev/null +++ b/LocalPackages/com.nimin.lowlevel/Runtime/nimin.lowlevel.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 10ae496f407b04f038c880a464f55c72 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LocalPackages/com.nimin.lowlevel/package.json b/LocalPackages/com.nimin.lowlevel/package.json new file mode 100644 index 0000000..c8595ae --- /dev/null +++ b/LocalPackages/com.nimin.lowlevel/package.json @@ -0,0 +1,15 @@ +{ + "name": "com.nimin.lowlevel", + "displayName": "GameCore LowLevel", + "version": "0.1.0", + "unity": "2021.3", + "description": "Low-level helper, contains custom collections", + "dependencies": { + "com.unity.collections": "1.2.4", + "com.unity.burst": "1.8.1" + }, + "keywords": [ + "LowLevel", + "Collections" + ] +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.lowlevel/package.json.meta b/LocalPackages/com.nimin.lowlevel/package.json.meta new file mode 100644 index 0000000..84c484c --- /dev/null +++ b/LocalPackages/com.nimin.lowlevel/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5f9f2b0e6f5f7472e8088bca5daed5ee +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs b/LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs new file mode 100644 index 0000000..a519fa8 --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs @@ -0,0 +1,25 @@ +using System; + +namespace GameCore.TinyECS +{ + public struct ComponentId + { + struct Inner where T : unmanaged + { + public int id; + private Inner(int i) => id = i; + public static Inner Instance = default; + } + + static int currentId; + + public static int Get() where T : unmanaged + { + if (Inner.Instance.id == 0) + { + Inner.Instance.id = ++currentId; + } + return Inner.Instance.id; + } + } +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs.meta b/LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs.meta new file mode 100644 index 0000000..1918fba --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/ComponentId.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27dc063854d0042ba9329b5bf058f2a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/Entity.cs b/LocalPackages/com.nimin.tinyecs/Runtime/Entity.cs index 4fa0fe5..28b94bc 100644 --- a/LocalPackages/com.nimin.tinyecs/Runtime/Entity.cs +++ b/LocalPackages/com.nimin.tinyecs/Runtime/Entity.cs @@ -15,34 +15,12 @@ namespace GameCore.TinyECS this.generation = generation; } - public override string ToString() - { - return $"Entity<{type}>({index},{generation})"; - } - - public bool Equals(Entity other) - { - return type.Equals(other.type) && index == other.index && generation == other.generation; - } - - public override bool Equals(object obj) - { - return obj is Entity other && Equals(other); - } + public override string ToString() => $"Entity<{type}>({index},{generation})"; + public bool Equals(Entity other) => type.Equals(other.type) && index == other.index && generation == other.generation; + public override bool Equals(object obj) => obj is Entity other && Equals(other); + public override int GetHashCode() => HashCode.Combine(type, index, generation); + public static bool operator ==(Entity lhs, Entity rhs) => lhs.Equals(rhs); + public static bool operator !=(Entity lhs, Entity rhs) => !(lhs == rhs); - public override int GetHashCode() - { - return HashCode.Combine(type, index, generation); - } - - public static bool operator ==(Entity lhs, Entity rhs) - { - return lhs.Equals(rhs); - } - - public static bool operator !=(Entity lhs, Entity rhs) - { - return !(lhs == rhs); - } } } \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs new file mode 100644 index 0000000..c13670e --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs @@ -0,0 +1,201 @@ +using System; +using Unity.Collections; +using Unity.Collections.LowLevel.Unsafe; +using System.Diagnostics; + +namespace GameCore.TinyECS +{ + public partial struct EntityDataBlockMeta + { + public FixedList64Bytes componentIdToIndex; + public FixedList128Bytes componentIdToOffset; + public int elementSize; + public int elementAlign; + } + + public unsafe struct EntityDataBlockChain : IDisposable + { + public readonly EntityDataBlockMeta blockMeta; + private FixedList512Bytes blockPtrList; + private int maxElementCountPerBlock; + private int elementCount; + + public int BlockCount => blockPtrList.Length; + public int BlockCapacity => blockPtrList.Capacity; + public int ElementCount => elementCount; + public int MaxElementCount => MaxElementCountPerBlock * BlockCapacity; + public int MaxElementCountPerBlock => maxElementCountPerBlock; + + public bool IsFull => elementCount == MaxElementCount; + public bool IsEmpty => elementCount == 0; + + public EntityDataBlockChain(EntityDataBlockMeta blockMeta, int maxElementCountPerBlock) + { + this.blockMeta = blockMeta; + blockPtrList = default; + this.maxElementCountPerBlock = maxElementCountPerBlock; + elementCount = 0; + } + + public void Dispose() + { + for (var i = BlockCount - 1; i >= 0; --i) + { + ReleaseBlock(i); + } + } + + void AllocBlock() + { + var bufferSize = blockMeta.elementSize * maxElementCountPerBlock; + var ptr = UnsafeUtility.Malloc(bufferSize, blockMeta.elementAlign, Allocator.Persistent); + + blockPtrList.Add((IntPtr)ptr); + } + + void ReleaseBlock(int blockIndex) + { + var pBlock = (void*)blockPtrList[blockIndex]; + if (pBlock != null) + { + UnsafeUtility.Free(pBlock, Allocator.Persistent); + blockPtrList.RemoveAt(blockIndex); + } + } + + void* ElementPtrAt(int elementIndex) + { + var blockIndex = elementIndex / maxElementCountPerBlock; + var pBlock = blockPtrList[blockIndex]; + return (byte*)pBlock + elementIndex * blockMeta.elementSize; + } + + void* ComponentPtrAt(int elementIndex) where T : unmanaged + { + var componentId = ComponentId.Get(); + var componentIndex = blockMeta.componentIdToIndex[componentId]; + if (componentIndex > 0) + { + var pElement = ElementPtrAt(elementIndex); + return (byte*)pElement + blockMeta.componentIdToOffset[componentId]; + } + + return null; + } + + [Conditional("DEBUG")] + void CheckElementIndex(int index) + { + if (index < 0 || index >= elementCount) + throw new IndexOutOfRangeException($"Invalid index: {index}"); + } + + [Conditional("DEBUG")] + void CheckBlockIndex(int index) + { + if (index < 0 || index > (elementCount / maxElementCountPerBlock)) + throw new IndexOutOfRangeException($"Invalid index: {index}"); + } + + public void Clear() + { + elementCount = 0; + } + + public void Add() + { + if (elementCount % maxElementCountPerBlock == 0) + { + if (IsFull) + throw new OutOfMemoryException("Block chain is full!"); + + var blockIndex = elementCount / maxElementCountPerBlock; + if (blockIndex >= BlockCount) + AllocBlock(); + } + + void* ptr = ElementPtrAt(elementCount); + UnsafeUtility.MemClear(ptr, blockMeta.elementSize); + + elementCount++; + } + + public void Remove(int index) + { + CheckElementIndex(index); + if (index != elementCount - 1) + { + var src = ElementPtrAt(elementCount - 1); + var dst = ElementPtrAt(index); + UnsafeUtility.MemCpy(dst, src, blockMeta.elementSize); + } + + elementCount--; + } + + public ref T GetData(int index) where T : unmanaged + { + CheckElementIndex(index); + var pComponent = ComponentPtrAt(index); + if (pComponent == null) + throw new Exception($"Invalid component type: {typeof(T)}"); + return ref UnsafeUtility.AsRef(pComponent); + } + + public EntityDataBlockView AsBlockView(int blockIndex) + { + CheckBlockIndex(blockIndex); + var ptr = (void*)blockPtrList[blockIndex]; + return new(ptr, blockMeta, maxElementCountPerBlock * blockIndex, elementCount); + } + } + + public unsafe readonly struct EntityDataBlockView + { + private readonly void* ptr; + public readonly EntityDataBlockMeta meta; + public readonly int elementStartIndex; + public readonly int elementCount; + + public EntityDataBlockView(void* ptr, EntityDataBlockMeta meta, int elementStartIndex, int elementCount) + { + this.ptr = ptr; + this.meta = meta; + this.elementStartIndex = elementStartIndex; + this.elementCount = elementCount; + } + + void* ElementPtrAt(int elementIndex) + { + return (byte*)ptr + elementIndex * meta.elementSize; + } + + void* ComponentPtrAt(int elementIndex) where T : unmanaged + { + var componentId = ComponentId.Get(); + var componentIndex = meta.componentIdToIndex[componentId]; + if (componentIndex > 0) + { + var pElement = ElementPtrAt(elementIndex); + return (byte*)pElement + meta.componentIdToOffset[componentId]; + } + + return null; + } + + [Conditional("DEBUG")] + void CheckIndex(int index) + { + if (index < elementStartIndex || index >= elementStartIndex + elementCount) + throw new IndexOutOfRangeException($"Invalid index: {index}"); + } + + public ref T GetData(int index) where T : unmanaged + { + var pComponent = ComponentPtrAt(index); + if (pComponent == null) + throw new Exception($"Invalid component type: {typeof(T)}"); + return ref UnsafeUtility.AsRef(pComponent); + } + } +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs.meta b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs.meta new file mode 100644 index 0000000..26e07fa --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 24392c1216204b6ea64acd57bb43441b +timeCreated: 1668251924 \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs new file mode 100644 index 0000000..e25eee8 --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs @@ -0,0 +1,45 @@ +using System; +using Unity.Collections; +using Unity.Collections.LowLevel.Unsafe; +using System.Diagnostics; +using GameCore.LowLevel; + +namespace GameCore.TinyECS +{ + public partial struct EntityDataBlockMeta + { + public static EntityDataBlockMeta Create() + where T1 : unmanaged + { + var meta = new EntityDataBlockMeta(); + meta.componentIdToIndex.Length = meta.componentIdToIndex.Capacity; + meta.componentIdToOffset.Length = meta.componentIdToOffset.Capacity; + + var id1 = ComponentId.Get(); + meta.componentIdToIndex[id1] = 1; + meta.componentIdToOffset[id1] = 0; + meta.elementSize = UnsafeUtility.SizeOf(); + meta.elementAlign = UnsafeUtility.AlignOf(); + return meta; + } + + public static EntityDataBlockMeta Create() + where T1 : unmanaged + where T2 : unmanaged + { + var meta = new EntityDataBlockMeta(); + meta.componentIdToIndex.Length = meta.componentIdToIndex.Capacity; + meta.componentIdToOffset.Length = meta.componentIdToOffset.Capacity; + + var id1 = ComponentId.Get(); + var id2 = ComponentId.Get(); + meta.componentIdToIndex[id1] = 1; + meta.componentIdToIndex[id2] = 2; + meta.componentIdToOffset[id1] = (short)StructUtility.OffsetOf<(T1, T2), T1>(); + meta.componentIdToOffset[id2] = (short)StructUtility.OffsetOf<(T1, T2), T2>(); + meta.elementSize = UnsafeUtility.SizeOf<(T1, T2)>(); + meta.elementAlign = UnsafeUtility.AlignOf<(T2, T2)>(); + return meta; + } + } +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs.meta b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs.meta new file mode 100644 index 0000000..0f7795a --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c9227b743e78463b8df770cefc98fb18 +timeCreated: 1668274486 \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs new file mode 100644 index 0000000..292f144 --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs @@ -0,0 +1,14 @@ +using System; +using Unity.Collections; +using Unity.Mathematics; + +namespace GameCore.TinyECS +{ + public struct EntityDataSet : IDisposable + { + public void Dispose() + { + //TODO + } + } +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs.meta b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs.meta new file mode 100644 index 0000000..3c0ed66 --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/EntityDataSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 842aeb285b0ae4d48af690621927f619 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef b/LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef new file mode 100644 index 0000000..a8a595f --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef @@ -0,0 +1,34 @@ +{ + "name": "nimin.tinyecs", + "rootNamespace": "", + "references": [ + "Unity.Collections", + "Unity.Mathematics", + "nimin.lowlevel" + ], + "includePlatforms": [ + "Android", + "Editor", + "iOS", + "LinuxStandalone64", + "Lumin", + "macOSStandalone", + "PS4", + "Stadia", + "Switch", + "tvOS", + "WSA", + "WebGL", + "WindowsStandalone32", + "WindowsStandalone64", + "XboxOne" + ], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef.meta b/LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef.meta new file mode 100644 index 0000000..a67bf6c --- /dev/null +++ b/LocalPackages/com.nimin.tinyecs/Runtime/nimin.tinyecs.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9cf4bf50619414a2296aa8fb1643a952 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LocalPackages/com.nimin.tinyecs/package.json b/LocalPackages/com.nimin.tinyecs/package.json index c12a72a..02d662d 100644 --- a/LocalPackages/com.nimin.tinyecs/package.json +++ b/LocalPackages/com.nimin.tinyecs/package.json @@ -1,14 +1,14 @@ { "name": "com.nimin.tinyecs", - "displayName": "Tiny ECS", + "displayName": "GameCore TinyECS", "version": "0.1.0", "unity": "2021.3", "description": "Data oriented ECS famework", "dependencies": { - "com.unity.collections": "1.2.4", - "com.unity.burst": "1.8.1" + "com.nimin.lowlevel": "0.1.0" }, "keywords": [ - "ECS", "JobSystem" + "ECS", + "JobSystem" ] - } +} \ No newline at end of file diff --git a/Packages/manifest.json b/Packages/manifest.json index 78fc72d..8afc3b6 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -41,6 +41,7 @@ "com.unity.modules.vr": "1.0.0", "com.unity.modules.wind": "1.0.0", "com.unity.modules.xr": "1.0.0", + "com.nimin.lowlevel": "file:../LocalPackages/com.nimin.lowlevel", "com.nimin.tinyecs": "file:../LocalPackages/com.nimin.tinyecs" } } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index ebd005f..aab9fe9 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,7 +1,7 @@ { "dependencies": { - "com.nimin.tinyecs": { - "version": "file:../LocalPackages/com.nimin.tinyecs", + "com.nimin.lowlevel": { + "version": "file:../LocalPackages/com.nimin.lowlevel", "depth": 0, "source": "local", "dependencies": { @@ -9,6 +9,14 @@ "com.unity.burst": "1.8.1" } }, + "com.nimin.tinyecs": { + "version": "file:../LocalPackages/com.nimin.tinyecs", + "depth": 0, + "source": "local", + "dependencies": { + "com.nimin.lowlevel": "0.1.0" + } + }, "com.unity.burst": { "version": "1.8.1", "depth": 1, diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index aff4620..93284cc 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -165,7 +165,8 @@ PlayerSettings: resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 - applicationIdentifier: {} + applicationIdentifier: + Standalone: com.DefaultCompany.UnityECS buildNumber: Standalone: 0 iPhone: 0 @@ -818,7 +819,7 @@ PlayerSettings: managedStrippingLevel: {} incrementalIl2cppBuild: {} suppressCommonWarnings: 1 - allowUnsafeCode: 0 + allowUnsafeCode: 1 useDeterministicCompilation: 1 enableRoslynAnalyzers: 1 additionalIl2CppArgs: diff --git a/ProjectSettings/SceneTemplateSettings.json b/ProjectSettings/SceneTemplateSettings.json new file mode 100644 index 0000000..6f3e60f --- /dev/null +++ b/ProjectSettings/SceneTemplateSettings.json @@ -0,0 +1,167 @@ +{ + "templatePinStates": [], + "dependencyTypeInfos": [ + { + "userAdded": false, + "type": "UnityEngine.AnimationClip", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.Animations.AnimatorController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.AnimatorOverrideController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.Audio.AudioMixerController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.ComputeShader", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Cubemap", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.GameObject", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.LightingDataAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": false + }, + { + "userAdded": false, + "type": "UnityEngine.LightingSettings", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Material", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.MonoScript", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicMaterial", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicsMaterial2D", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.VolumeProfile", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.SceneAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": false + }, + { + "userAdded": false, + "type": "UnityEngine.Shader", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.ShaderVariantCollection", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Texture", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Texture2D", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Timeline.TimelineAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + } + ], + "defaultDependencyTypeInfo": { + "userAdded": false, + "type": "", + "ignore": false, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + "newSceneOverride": 0 +} \ No newline at end of file