├── .gitattributes ├── .gitignore ├── Assets ├── Plugins.meta ├── Scenes.meta ├── Scenes │ ├── Sprite Rendering Example.meta │ └── Sprite Rendering Example │ │ ├── SpriteRendererMovementSystem.cs │ │ ├── SpriteRendererMovementSystem.cs.meta │ │ ├── SpriteRendererScene.unity │ │ ├── SpriteRendererScene.unity.meta │ │ ├── SpriteRendererSceneBootstrap.cs │ │ ├── SpriteRendererSceneBootstrap.cs.meta │ │ ├── Sprites.meta │ │ └── Sprites │ │ ├── elephant.png │ │ ├── elephant.png.meta │ │ ├── giraffe.png │ │ ├── giraffe.png.meta │ │ ├── moose.png │ │ └── moose.png.meta ├── Scripts.meta └── Scripts │ ├── Rendering.meta │ ├── Rendering │ ├── SpriteInstanceRenderSystem.cs │ ├── SpriteInstanceRenderSystem.cs.meta │ ├── SpriteInstanceRendererComponent.cs │ └── SpriteInstanceRendererComponent.cs.meta │ ├── Shaders.meta │ ├── Shaders │ ├── Instanced Sprite.shader │ └── Instanced Sprite.shader.meta │ ├── Utils.meta │ └── Utils │ ├── MeshUtils.cs │ └── MeshUtils.cs.meta ├── LICENSE ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | 7 | # Binaries and custom/local-only folders I don't want synced 8 | Assets/OtherAssets/ 9 | Assets/Plugins/ 10 | Assets/Standard Assets/ 11 | Assets/AssetStoreTools/ 12 | 13 | # JetBrains Rider cache directory ? 14 | .idea 15 | 16 | # Visual Studio 2015 cache directory 17 | /.vs/ 18 | 19 | # Autogenerated VS/MD/Consulo solution and project files 20 | ExportedObj/ 21 | .consulo/ 22 | *.csproj 23 | *.unityproj 24 | *.sln 25 | *.suo 26 | *.tmp 27 | *.user 28 | *.userprefs 29 | *.pidb 30 | *.booproj 31 | *.svd 32 | *.pdb 33 | 34 | # Unity3D generated meta files 35 | *.pidb.meta 36 | 37 | # Unity3D Generated File On Crash Reports 38 | sysinfo.txt 39 | 40 | # Builds 41 | *.apk 42 | *.unitypackage 43 | 44 | # Potential OS generated files 45 | .DS_Store* 46 | ._* 47 | .Spotlight-V100 48 | .Trashes 49 | [Tt]humbs.db -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48cad1e5572d5ed43bbab0bc214bbb19 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b684bb3cdef2e9d4094eecf1e7375367 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e1f3307726824a4890b6917284c44a4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/SpriteRendererMovementSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Burst; 2 | using Unity.Entities; 3 | using Unity.Jobs; 4 | using Unity.Mathematics; 5 | using Unity.Transforms; 6 | using UnityEngine; 7 | 8 | namespace toinfiniityandbeyond.Examples 9 | { 10 | //Just gives the animals a little movement as an example 11 | public class EntityMovementSystem : JobComponentSystem 12 | { 13 | [BurstCompile] 14 | struct PositionJob : IJobProcessComponentData 15 | { 16 | public float dt; 17 | 18 | public void Execute(ref Position position) 19 | { 20 | float wobbleX = Mathf.PerlinNoise(position.Value.x, position.Value.y) - 0.5f; 21 | float wobbleY = Mathf.PerlinNoise(position.Value.y, position.Value.x) - 0.5f; 22 | position.Value += dt * new float3(wobbleX, wobbleY, 0); 23 | } 24 | } 25 | 26 | protected override JobHandle OnUpdate(JobHandle inputDeps) 27 | { 28 | var job = new PositionJob() {dt = Time.deltaTime}; 29 | return job.Schedule(this, inputDeps); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/SpriteRendererMovementSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dc3a83cd2ce3c24ebb50f9af28a98e8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/SpriteRendererScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_TemporalCoherenceThreshold: 1 54 | m_EnvironmentLightingMode: 0 55 | m_EnableBakedLightmaps: 0 56 | m_EnableRealtimeLightmaps: 0 57 | m_LightmapEditorSettings: 58 | serializedVersion: 10 59 | m_Resolution: 2 60 | m_BakeResolution: 40 61 | m_AtlasSize: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &387816781 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_CorrespondingSourceObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 6 122 | m_Component: 123 | - component: {fileID: 387816784} 124 | - component: {fileID: 387816783} 125 | - component: {fileID: 387816782} 126 | m_Layer: 0 127 | m_Name: EventSystem 128 | m_TagString: Untagged 129 | m_Icon: {fileID: 0} 130 | m_NavMeshLayer: 0 131 | m_StaticEditorFlags: 0 132 | m_IsActive: 1 133 | --- !u!114 &387816782 134 | MonoBehaviour: 135 | m_ObjectHideFlags: 0 136 | m_CorrespondingSourceObject: {fileID: 0} 137 | m_PrefabInternal: {fileID: 0} 138 | m_GameObject: {fileID: 387816781} 139 | m_Enabled: 1 140 | m_EditorHideFlags: 0 141 | m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} 142 | m_Name: 143 | m_EditorClassIdentifier: 144 | m_HorizontalAxis: Horizontal 145 | m_VerticalAxis: Vertical 146 | m_SubmitButton: Submit 147 | m_CancelButton: Cancel 148 | m_InputActionsPerSecond: 10 149 | m_RepeatDelay: 0.5 150 | m_ForceModuleActive: 0 151 | --- !u!114 &387816783 152 | MonoBehaviour: 153 | m_ObjectHideFlags: 0 154 | m_CorrespondingSourceObject: {fileID: 0} 155 | m_PrefabInternal: {fileID: 0} 156 | m_GameObject: {fileID: 387816781} 157 | m_Enabled: 1 158 | m_EditorHideFlags: 0 159 | m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} 160 | m_Name: 161 | m_EditorClassIdentifier: 162 | m_FirstSelected: {fileID: 0} 163 | m_sendNavigationEvents: 1 164 | m_DragThreshold: 10 165 | --- !u!4 &387816784 166 | Transform: 167 | m_ObjectHideFlags: 0 168 | m_CorrespondingSourceObject: {fileID: 0} 169 | m_PrefabInternal: {fileID: 0} 170 | m_GameObject: {fileID: 387816781} 171 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 172 | m_LocalPosition: {x: 0, y: 0, z: 0} 173 | m_LocalScale: {x: 1, y: 1, z: 1} 174 | m_Children: [] 175 | m_Father: {fileID: 0} 176 | m_RootOrder: 2 177 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 178 | --- !u!1 &519420028 179 | GameObject: 180 | m_ObjectHideFlags: 0 181 | m_CorrespondingSourceObject: {fileID: 0} 182 | m_PrefabInternal: {fileID: 0} 183 | serializedVersion: 6 184 | m_Component: 185 | - component: {fileID: 519420032} 186 | - component: {fileID: 519420031} 187 | - component: {fileID: 519420029} 188 | m_Layer: 0 189 | m_Name: Main Camera 190 | m_TagString: MainCamera 191 | m_Icon: {fileID: 0} 192 | m_NavMeshLayer: 0 193 | m_StaticEditorFlags: 0 194 | m_IsActive: 1 195 | --- !u!81 &519420029 196 | AudioListener: 197 | m_ObjectHideFlags: 0 198 | m_CorrespondingSourceObject: {fileID: 0} 199 | m_PrefabInternal: {fileID: 0} 200 | m_GameObject: {fileID: 519420028} 201 | m_Enabled: 1 202 | --- !u!20 &519420031 203 | Camera: 204 | m_ObjectHideFlags: 0 205 | m_CorrespondingSourceObject: {fileID: 0} 206 | m_PrefabInternal: {fileID: 0} 207 | m_GameObject: {fileID: 519420028} 208 | m_Enabled: 1 209 | serializedVersion: 2 210 | m_ClearFlags: 2 211 | m_BackGroundColor: {r: 0.3137255, g: 0.3764706, b: 0.3283225, a: 0} 212 | m_projectionMatrixMode: 1 213 | m_SensorSize: {x: 36, y: 24} 214 | m_LensShift: {x: 0, y: 0} 215 | m_FocalLength: 50 216 | m_NormalizedViewPortRect: 217 | serializedVersion: 2 218 | x: 0 219 | y: 0 220 | width: 1 221 | height: 1 222 | near clip plane: 0.3 223 | far clip plane: 1000 224 | field of view: 60 225 | orthographic: 1 226 | orthographic size: 12.5 227 | m_Depth: -1 228 | m_CullingMask: 229 | serializedVersion: 2 230 | m_Bits: 4294967295 231 | m_RenderingPath: -1 232 | m_TargetTexture: {fileID: 0} 233 | m_TargetDisplay: 0 234 | m_TargetEye: 0 235 | m_HDR: 1 236 | m_AllowMSAA: 0 237 | m_AllowDynamicResolution: 0 238 | m_ForceIntoRT: 0 239 | m_OcclusionCulling: 0 240 | m_StereoConvergence: 10 241 | m_StereoSeparation: 0.022 242 | --- !u!4 &519420032 243 | Transform: 244 | m_ObjectHideFlags: 0 245 | m_CorrespondingSourceObject: {fileID: 0} 246 | m_PrefabInternal: {fileID: 0} 247 | m_GameObject: {fileID: 519420028} 248 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 249 | m_LocalPosition: {x: 25, y: 10, z: -100} 250 | m_LocalScale: {x: 1, y: 1, z: 1} 251 | m_Children: [] 252 | m_Father: {fileID: 0} 253 | m_RootOrder: 0 254 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 255 | --- !u!1 &523439332 256 | GameObject: 257 | m_ObjectHideFlags: 0 258 | m_CorrespondingSourceObject: {fileID: 0} 259 | m_PrefabInternal: {fileID: 0} 260 | serializedVersion: 6 261 | m_Component: 262 | - component: {fileID: 523439333} 263 | - component: {fileID: 523439335} 264 | - component: {fileID: 523439334} 265 | m_Layer: 5 266 | m_Name: Text 267 | m_TagString: Untagged 268 | m_Icon: {fileID: 0} 269 | m_NavMeshLayer: 0 270 | m_StaticEditorFlags: 0 271 | m_IsActive: 1 272 | --- !u!224 &523439333 273 | RectTransform: 274 | m_ObjectHideFlags: 0 275 | m_CorrespondingSourceObject: {fileID: 0} 276 | m_PrefabInternal: {fileID: 0} 277 | m_GameObject: {fileID: 523439332} 278 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 279 | m_LocalPosition: {x: 0, y: 0, z: 0} 280 | m_LocalScale: {x: 1, y: 1, z: 1} 281 | m_Children: [] 282 | m_Father: {fileID: 1846243648} 283 | m_RootOrder: 0 284 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 285 | m_AnchorMin: {x: 0.5, y: 1} 286 | m_AnchorMax: {x: 0.5, y: 1} 287 | m_AnchoredPosition: {x: 0, y: -25} 288 | m_SizeDelta: {x: 500, y: 40} 289 | m_Pivot: {x: 0.5, y: 1} 290 | --- !u!114 &523439334 291 | MonoBehaviour: 292 | m_ObjectHideFlags: 0 293 | m_CorrespondingSourceObject: {fileID: 0} 294 | m_PrefabInternal: {fileID: 0} 295 | m_GameObject: {fileID: 523439332} 296 | m_Enabled: 1 297 | m_EditorHideFlags: 0 298 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 299 | m_Name: 300 | m_EditorClassIdentifier: 301 | m_Material: {fileID: 0} 302 | m_Color: {r: 0, g: 0, b: 0, a: 1} 303 | m_RaycastTarget: 1 304 | m_OnCullStateChanged: 305 | m_PersistentCalls: 306 | m_Calls: [] 307 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 308 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 309 | m_FontData: 310 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 311 | m_FontSize: 30 312 | m_FontStyle: 1 313 | m_BestFit: 0 314 | m_MinSize: 3 315 | m_MaxSize: 40 316 | m_Alignment: 4 317 | m_AlignByGeometry: 1 318 | m_RichText: 1 319 | m_HorizontalOverflow: 0 320 | m_VerticalOverflow: 0 321 | m_LineSpacing: 1 322 | m_Text: Press play for 10,000 animals 323 | --- !u!222 &523439335 324 | CanvasRenderer: 325 | m_ObjectHideFlags: 0 326 | m_CorrespondingSourceObject: {fileID: 0} 327 | m_PrefabInternal: {fileID: 0} 328 | m_GameObject: {fileID: 523439332} 329 | m_CullTransparentMesh: 0 330 | --- !u!1 &1763039987 331 | GameObject: 332 | m_ObjectHideFlags: 0 333 | m_CorrespondingSourceObject: {fileID: 0} 334 | m_PrefabInternal: {fileID: 0} 335 | serializedVersion: 6 336 | m_Component: 337 | - component: {fileID: 1763039988} 338 | - component: {fileID: 1763039992} 339 | - component: {fileID: 1763039989} 340 | m_Layer: 0 341 | m_Name: GameObject 342 | m_TagString: Untagged 343 | m_Icon: {fileID: 0} 344 | m_NavMeshLayer: 0 345 | m_StaticEditorFlags: 0 346 | m_IsActive: 1 347 | --- !u!4 &1763039988 348 | Transform: 349 | m_ObjectHideFlags: 0 350 | m_CorrespondingSourceObject: {fileID: 0} 351 | m_PrefabInternal: {fileID: 0} 352 | m_GameObject: {fileID: 1763039987} 353 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 354 | m_LocalPosition: {x: 0, y: 0, z: 0} 355 | m_LocalScale: {x: 1, y: 1, z: 1} 356 | m_Children: [] 357 | m_Father: {fileID: 0} 358 | m_RootOrder: 3 359 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 360 | --- !u!114 &1763039989 361 | MonoBehaviour: 362 | m_ObjectHideFlags: 0 363 | m_CorrespondingSourceObject: {fileID: 0} 364 | m_PrefabInternal: {fileID: 0} 365 | m_GameObject: {fileID: 1763039987} 366 | m_Enabled: 1 367 | m_EditorHideFlags: 0 368 | m_Script: {fileID: 11500000, guid: 5aa78c5bc7d72444695a22d3ea7e33ab, type: 3} 369 | m_Name: 370 | m_EditorClassIdentifier: 371 | m_SerializedData: 372 | sprite: {fileID: 10305, guid: 0000000000000000f000000000000000, type: 0} 373 | pixelsPerUnit: 32 374 | pivot: 375 | x: 0 376 | y: 0 377 | --- !u!114 &1763039992 378 | MonoBehaviour: 379 | m_ObjectHideFlags: 0 380 | m_CorrespondingSourceObject: {fileID: 0} 381 | m_PrefabInternal: {fileID: 0} 382 | m_GameObject: {fileID: 1763039987} 383 | m_Enabled: 1 384 | m_EditorHideFlags: 0 385 | m_Script: {fileID: 11500000, guid: 5bf10cdea1344482e91a4f2b58506b77, type: 3} 386 | m_Name: 387 | m_EditorClassIdentifier: 388 | --- !u!1 &1846243644 389 | GameObject: 390 | m_ObjectHideFlags: 0 391 | m_CorrespondingSourceObject: {fileID: 0} 392 | m_PrefabInternal: {fileID: 0} 393 | serializedVersion: 6 394 | m_Component: 395 | - component: {fileID: 1846243648} 396 | - component: {fileID: 1846243647} 397 | - component: {fileID: 1846243646} 398 | - component: {fileID: 1846243645} 399 | m_Layer: 5 400 | m_Name: Canvas 401 | m_TagString: Untagged 402 | m_Icon: {fileID: 0} 403 | m_NavMeshLayer: 0 404 | m_StaticEditorFlags: 0 405 | m_IsActive: 1 406 | --- !u!114 &1846243645 407 | MonoBehaviour: 408 | m_ObjectHideFlags: 0 409 | m_CorrespondingSourceObject: {fileID: 0} 410 | m_PrefabInternal: {fileID: 0} 411 | m_GameObject: {fileID: 1846243644} 412 | m_Enabled: 1 413 | m_EditorHideFlags: 0 414 | m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} 415 | m_Name: 416 | m_EditorClassIdentifier: 417 | m_IgnoreReversedGraphics: 1 418 | m_BlockingObjects: 0 419 | m_BlockingMask: 420 | serializedVersion: 2 421 | m_Bits: 4294967295 422 | --- !u!114 &1846243646 423 | MonoBehaviour: 424 | m_ObjectHideFlags: 0 425 | m_CorrespondingSourceObject: {fileID: 0} 426 | m_PrefabInternal: {fileID: 0} 427 | m_GameObject: {fileID: 1846243644} 428 | m_Enabled: 1 429 | m_EditorHideFlags: 0 430 | m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} 431 | m_Name: 432 | m_EditorClassIdentifier: 433 | m_UiScaleMode: 0 434 | m_ReferencePixelsPerUnit: 100 435 | m_ScaleFactor: 1 436 | m_ReferenceResolution: {x: 800, y: 600} 437 | m_ScreenMatchMode: 0 438 | m_MatchWidthOrHeight: 0 439 | m_PhysicalUnit: 3 440 | m_FallbackScreenDPI: 96 441 | m_DefaultSpriteDPI: 96 442 | m_DynamicPixelsPerUnit: 1 443 | --- !u!223 &1846243647 444 | Canvas: 445 | m_ObjectHideFlags: 0 446 | m_CorrespondingSourceObject: {fileID: 0} 447 | m_PrefabInternal: {fileID: 0} 448 | m_GameObject: {fileID: 1846243644} 449 | m_Enabled: 1 450 | serializedVersion: 3 451 | m_RenderMode: 0 452 | m_Camera: {fileID: 0} 453 | m_PlaneDistance: 100 454 | m_PixelPerfect: 1 455 | m_ReceivesEvents: 1 456 | m_OverrideSorting: 0 457 | m_OverridePixelPerfect: 0 458 | m_SortingBucketNormalizedSize: 0 459 | m_AdditionalShaderChannelsFlag: 0 460 | m_SortingLayerID: 0 461 | m_SortingOrder: 0 462 | m_TargetDisplay: 0 463 | --- !u!224 &1846243648 464 | RectTransform: 465 | m_ObjectHideFlags: 0 466 | m_CorrespondingSourceObject: {fileID: 0} 467 | m_PrefabInternal: {fileID: 0} 468 | m_GameObject: {fileID: 1846243644} 469 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 470 | m_LocalPosition: {x: 0, y: 0, z: 0} 471 | m_LocalScale: {x: 0, y: 0, z: 0} 472 | m_Children: 473 | - {fileID: 523439333} 474 | m_Father: {fileID: 0} 475 | m_RootOrder: 1 476 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 477 | m_AnchorMin: {x: 0, y: 0} 478 | m_AnchorMax: {x: 0, y: 0} 479 | m_AnchoredPosition: {x: 0, y: 0} 480 | m_SizeDelta: {x: 0, y: 0} 481 | m_Pivot: {x: 0, y: 0} 482 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/SpriteRendererScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cda990e2423bbf4892e6590ba056729 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/SpriteRendererSceneBootstrap.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Entities; 3 | using Unity.Mathematics; 4 | using Unity.Transforms; 5 | 6 | using toinfiniityandbeyond.Rendering2D; 7 | using UnityEditor; 8 | using UnityEngine.SceneManagement; 9 | using Random = UnityEngine.Random; 10 | 11 | namespace toinfiniityandbeyond.Examples 12 | { 13 | public sealed class SpriteRendererSceneBootstrap 14 | { 15 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] 16 | public static void InitializeAfterScene() 17 | { 18 | var scene = SceneManager.GetActiveScene(); 19 | if (scene.name != "SpriteRendererScene") 20 | return; 21 | 22 | var entityManager = World.Active.GetOrCreateManager(); 23 | 24 | //Load all the sprites we need 25 | var animalSprites = new[] 26 | { 27 | AssetDatabase.LoadAssetAtPath("Assets/Scenes/Sprite Rendering Example/Sprites/elephant.png"), 28 | AssetDatabase.LoadAssetAtPath("Assets/Scenes/Sprite Rendering Example/Sprites/giraffe.png"), 29 | AssetDatabase.LoadAssetAtPath("Assets/Scenes/Sprite Rendering Example/Sprites/moose.png"), 30 | }; 31 | //Assign loaded sprites to sprite renderers 32 | var renderers = new[] 33 | { 34 | new SpriteInstanceRenderer(animalSprites[0], animalSprites[0].width, new float2(0.5f, 0.5f)), 35 | new SpriteInstanceRenderer(animalSprites[1], animalSprites[1].width, new float2(0.5f, 0.5f)), 36 | new SpriteInstanceRenderer(animalSprites[2], animalSprites[2].width, new float2(0.5f, 0.5f)), 37 | }; 38 | //Spawn 10,000 entities with random positions/rotations 39 | for (int i = 0; i < 10000; i++) 40 | { 41 | var entity = entityManager.CreateEntity(ComponentType.Create(), 42 | ComponentType.Create()); 43 | 44 | entityManager.SetComponentData(entity, new Position 45 | { 46 | Value = new float3(Random.value * 50, Random.value * 25, 0) 47 | }); 48 | 49 | entityManager.SetComponentData(entity, new Rotation 50 | { 51 | Value = quaternion.Euler(0, 0, Random.value * Mathf.PI * 2) 52 | }); 53 | 54 | entityManager.AddSharedComponentData(entity, renderers[i % 3]); 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/SpriteRendererSceneBootstrap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 756f5ead522a5894ead473221360379c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2945a6fcbc8c365458ffc347adb10a85 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites/elephant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paullj/unity-ecs-instanced-sprite-renderer/7b246fa8be67f0a46f2fe416c48b645d830fb596/Assets/Scenes/Sprite Rendering Example/Sprites/elephant.png -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites/elephant.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 970fe1cea56e20940a0b07f804223abd 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 5 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: 1 36 | wrapV: 1 37 | wrapW: 1 38 | nPOTScale: 0 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 49 | alphaUsage: 1 50 | alphaIsTransparency: 1 51 | spriteTessellationDetail: -1 52 | textureType: 8 53 | textureShape: 1 54 | singleChannelComponent: 0 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - serializedVersion: 2 60 | buildTarget: DefaultTexturePlatform 61 | maxTextureSize: 2048 62 | resizeAlgorithm: 0 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | androidETC2FallbackOverride: 0 70 | spriteSheet: 71 | serializedVersion: 2 72 | sprites: [] 73 | outline: [] 74 | physicsShape: [] 75 | bones: [] 76 | spriteID: d0059ba3c10ee2f43ae659116d7efc93 77 | vertices: [] 78 | indices: 79 | edges: [] 80 | weights: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites/giraffe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paullj/unity-ecs-instanced-sprite-renderer/7b246fa8be67f0a46f2fe416c48b645d830fb596/Assets/Scenes/Sprite Rendering Example/Sprites/giraffe.png -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites/giraffe.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed97a509d50ffbe4c8c98d33c0d3aa25 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 5 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: 1 36 | wrapV: 1 37 | wrapW: 1 38 | nPOTScale: 0 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 49 | alphaUsage: 1 50 | alphaIsTransparency: 1 51 | spriteTessellationDetail: -1 52 | textureType: 8 53 | textureShape: 1 54 | singleChannelComponent: 0 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - serializedVersion: 2 60 | buildTarget: DefaultTexturePlatform 61 | maxTextureSize: 2048 62 | resizeAlgorithm: 0 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | androidETC2FallbackOverride: 0 70 | spriteSheet: 71 | serializedVersion: 2 72 | sprites: [] 73 | outline: [] 74 | physicsShape: [] 75 | bones: [] 76 | spriteID: 360dc54bf77024447b3a7897d244198e 77 | vertices: [] 78 | indices: 79 | edges: [] 80 | weights: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites/moose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paullj/unity-ecs-instanced-sprite-renderer/7b246fa8be67f0a46f2fe416c48b645d830fb596/Assets/Scenes/Sprite Rendering Example/Sprites/moose.png -------------------------------------------------------------------------------- /Assets/Scenes/Sprite Rendering Example/Sprites/moose.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 707e4cdadf91845c7a57d9161d3ad896 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 7722ed162209d4cce972e462ad178337 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce86c6057ffb0a0438673c36b3f2e219 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Rendering.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd59a840f9f8431b896426bbc2940b4b 3 | timeCreated: 1523010231 -------------------------------------------------------------------------------- /Assets/Scripts/Rendering/SpriteInstanceRenderSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Collections.LowLevel.Unsafe; 3 | using Unity.Entities; 4 | using Unity.Mathematics; 5 | using Unity.Transforms; 6 | using UnityEngine; 7 | using UnityEngine.Assertions; 8 | using UnityEngine.Experimental.PlayerLoop; 9 | 10 | namespace toinfiniityandbeyond.Rendering2D 11 | { 12 | /// 13 | /// Renders all Entities containing both SpriteInstanceRenderer & LocalToWorld components. 14 | /// 15 | [UpdateAfter(typeof(PreLateUpdate.ParticleSystemBeginUpdateAll))] 16 | [ExecuteInEditMode] 17 | public class SpriteInstanceRendererSystem : ComponentSystem 18 | { 19 | private readonly Dictionary materialCahce = new Dictionary(); 20 | private readonly Dictionary meshCache = new Dictionary(); 21 | 22 | // Instance renderer takes only batches of 1023 23 | private readonly Matrix4x4[] matricesArray = new Matrix4x4[1023]; 24 | private readonly List cacheduniqueRendererTypes = new List(10); 25 | private ComponentGroup instanceRendererGroup; 26 | 27 | // This is the ugly bit, necessary until Graphics.DrawMeshInstanced supports NativeArrays pulling the data in from a job. 28 | private static unsafe void CopyMatrices(ComponentDataArray transforms, int beginIndex, int length, Matrix4x4[] outMatrices) 29 | { 30 | // @TODO: This is using unsafe code because the Unity DrawInstances API takes a Matrix4x4[] instead of NativeArray. 31 | // We want to use the ComponentDataArray.CopyTo method 32 | // because internally it uses memcpy to copy the data, 33 | // if the nativeslice layout matches the layout of the component data. It's very fast... 34 | fixed (Matrix4x4* matricesPtr = outMatrices) 35 | { 36 | Assert.AreEqual(sizeof(Matrix4x4), sizeof(LocalToWorld)); 37 | var matricesSlice = NativeSliceUnsafeUtility.ConvertExistingDataToNativeSlice(matricesPtr, sizeof(Matrix4x4), length); 38 | #if ENABLE_UNITY_COLLECTIONS_CHECKS 39 | NativeSliceUnsafeUtility.SetAtomicSafetyHandle(ref matricesSlice, AtomicSafetyHandle.GetTempUnsafePtrSliceHandle()); 40 | #endif 41 | 42 | transforms.CopyTo(matricesSlice, beginIndex); 43 | } 44 | } 45 | 46 | protected override void OnStartRunning() 47 | { 48 | // We want to find all MeshInstanceRenderer & LocalToWorld combinations and render them 49 | instanceRendererGroup = GetComponentGroup(typeof(SpriteInstanceRenderer), typeof(LocalToWorld)); 50 | } 51 | 52 | protected override void OnUpdate() 53 | { 54 | // We want to iterate over all unique MeshInstanceRenderer shared component data, 55 | // that are attached to any entities in the world 56 | EntityManager.GetAllUniqueSharedComponentData(cacheduniqueRendererTypes); 57 | for (int i = 0;i != cacheduniqueRendererTypes.Count;i++) 58 | { 59 | // For each unique MeshInstanceRenderer data, we want to get all entities with a LocalToWorld 60 | // SharedComponentData gurantees that all those entities are packed togehter in a chunk with linear memory layout. 61 | // As a result the copy of the matrices out is internally done via memcpy. 62 | var renderer = cacheduniqueRendererTypes[i]; 63 | if (renderer.sprite == null) 64 | continue; 65 | instanceRendererGroup.SetFilter(renderer); 66 | var transforms = instanceRendererGroup.GetComponentDataArray(); 67 | 68 | Mesh mesh; 69 | Material material; 70 | var size = new float2(renderer.sprite.width / (float)renderer.pixelsPerUnit, 71 | renderer.sprite.height / (float)renderer.pixelsPerUnit); 72 | float2 meshPivot = renderer.pivot * size; 73 | if (!meshCache.TryGetValue(renderer, out mesh)) 74 | { 75 | mesh = MeshUtils.GenerateQuad(size, meshPivot); 76 | meshCache.Add(renderer, mesh); 77 | } 78 | 79 | if (!materialCahce.TryGetValue(renderer, out material)) 80 | { 81 | material = new Material(Shader.Find("Sprites/Instanced")) 82 | { 83 | enableInstancing = true, 84 | mainTexture = renderer.sprite 85 | }; 86 | materialCahce.Add(renderer, material); 87 | } 88 | 89 | // Graphics.DrawMeshInstanced has a set of limitations that are not optimal for working with ECS. 90 | // Specifically: 91 | // * No way to push the matrices from a job 92 | // * no NativeArray API, currently uses Matrix4x4[] 93 | // As a result this code is not yet jobified. 94 | // We are planning to adjust this API to make it more efficient for this use case. 95 | 96 | // For now, we have to copy our data into Matrix4x4[] with a specific upper limit of how many instances we can render in one batch. 97 | // So we just have a for loop here, representing each Graphics.DrawMeshInstanced batch 98 | int beginIndex = 0; 99 | while (beginIndex < transforms.Length) 100 | { 101 | int length = math.min(matricesArray.Length, transforms.Length - beginIndex); 102 | CopyMatrices(transforms, beginIndex, length, matricesArray); 103 | Graphics.DrawMeshInstanced(mesh, 0, material, matricesArray, length); 104 | 105 | beginIndex += length; 106 | } 107 | } 108 | cacheduniqueRendererTypes.Clear(); 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /Assets/Scripts/Rendering/SpriteInstanceRenderSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56d5d6335803a394e8efb1ad5896179f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Rendering/SpriteInstanceRendererComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Unity.Entities; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | namespace toinfiniityandbeyond.Rendering2D 7 | { 8 | [Serializable] 9 | public struct SpriteInstanceRenderer : ISharedComponentData 10 | { 11 | public Texture2D sprite; 12 | public int pixelsPerUnit; 13 | public float2 pivot; 14 | 15 | public SpriteInstanceRenderer(Texture2D sprite, int pixelsPerUnit, float2 pivot) 16 | { 17 | this.sprite = sprite; 18 | this.pixelsPerUnit = pixelsPerUnit; 19 | this.pivot = pivot; 20 | } 21 | } 22 | 23 | public class SpriteInstanceRendererComponent : SharedComponentDataWrapper { } 24 | } -------------------------------------------------------------------------------- /Assets/Scripts/Rendering/SpriteInstanceRendererComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5aa78c5bc7d72444695a22d3ea7e33ab 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23e36ade7d72e31469f29ea49cb328ca 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Shaders/Instanced Sprite.shader: -------------------------------------------------------------------------------- 1 | Shader "Sprites/Instanced" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } 10 | LOD 100 11 | Blend SrcAlpha OneMinusSrcAlpha 12 | 13 | Pass 14 | { 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | #pragma multi_compile_instancing 19 | #include "UnityCG.cginc" 20 | 21 | struct appdata 22 | { 23 | float4 vertex : POSITION; 24 | UNITY_VERTEX_INPUT_INSTANCE_ID 25 | float2 uv : TEXCOORD0; 26 | }; 27 | 28 | struct v2f 29 | { 30 | float2 uv : TEXCOORD0; 31 | float4 vertex : SV_POSITION; 32 | }; 33 | 34 | sampler2D _MainTex; 35 | float4 _MainTex_ST; 36 | 37 | // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader. 38 | // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing. 39 | // #pragma instancing_options assumeuniformscaling 40 | UNITY_INSTANCING_BUFFER_START(Props) 41 | //stuff 42 | UNITY_INSTANCING_BUFFER_END(Props) 43 | 44 | v2f vert (appdata v) 45 | { 46 | v2f o; 47 | UNITY_SETUP_INSTANCE_ID(v); 48 | o.vertex = UnityObjectToClipPos(v.vertex); 49 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 50 | return o; 51 | } 52 | 53 | fixed4 frag (v2f i) : SV_Target 54 | { 55 | // sample the texture 56 | fixed4 col = tex2D(_MainTex, i.uv); 57 | return col; 58 | } 59 | ENDCG 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/Scripts/Shaders/Instanced Sprite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48a864aee4e34564f8cb08fedf83456d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 581374a710f64512aa358b5824a4e23b 3 | timeCreated: 1523015065 -------------------------------------------------------------------------------- /Assets/Scripts/Utils/MeshUtils.cs: -------------------------------------------------------------------------------- 1 | using Unity.Mathematics; 2 | using UnityEngine; 3 | 4 | public static class MeshUtils 5 | { 6 | /// 7 | /// Generates a simple quad of any size 8 | /// 9 | /// The size of the quad 10 | /// Where the mesh pivots 11 | /// The quad mesh 12 | public static Mesh GenerateQuad(float2 size, float2 pivot) 13 | { 14 | float2 scaledPivot = size * pivot; 15 | Vector3[] _vertices = 16 | { 17 | new Vector3(size.x - scaledPivot.x, size.y - scaledPivot.y, 0), 18 | new Vector3(size.x - scaledPivot.x, -scaledPivot.y, 0), 19 | new Vector3(-scaledPivot.x, -scaledPivot.y, 0), 20 | new Vector3(-scaledPivot.x, size.y - scaledPivot.y, 0), 21 | }; 22 | 23 | Vector2[] _uv = 24 | { 25 | new Vector2(1, 1), 26 | new Vector2(1, 0), 27 | new Vector2(0, 0), 28 | new Vector2(0, 1) 29 | }; 30 | 31 | int[] triangles = 32 | { 33 | 0, 1, 2, 34 | 2, 3, 0 35 | }; 36 | 37 | return new Mesh 38 | { 39 | vertices = _vertices, 40 | uv = _uv, 41 | triangles = triangles 42 | }; 43 | } 44 | } -------------------------------------------------------------------------------- /Assets/Scripts/Utils/MeshUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f204843e24cc5e04e9ee6c64fa467648 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 toinfiniityandbeyond 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.entities": "0.0.12-preview.19", 4 | "com.unity.package-manager-ui": "1.9.11", 5 | "com.unity.modules.ui": "1.0.0" 6 | }, 7 | "testables": [ 8 | "com.unity.collections", 9 | "com.unity.entities", 10 | "com.unity.jobs" 11 | ], 12 | "registry": "https://staging-packages.unity.com" 13 | } 14 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: 2cda990e2423bbf4892e6590ba056729 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 1 11 | m_SpritePackerMode: 4 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | m_EnableTextureStreamingInPlayMode: 1 23 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 34 | m_PreloadedShaders: [] 35 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 36 | type: 0} 37 | m_CustomRenderPipeline: {fileID: 0} 38 | m_TransparencySortMode: 0 39 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 40 | m_DefaultRenderingPath: 1 41 | m_DefaultMobileRenderingPath: 1 42 | m_TierSettings: [] 43 | m_LightmapStripping: 0 44 | m_FogStripping: 0 45 | m_InstancingStripping: 0 46 | m_LightmapKeepPlain: 1 47 | m_LightmapKeepDirCombined: 1 48 | m_LightmapKeepDynamicPlain: 1 49 | m_LightmapKeepDynamicDirCombined: 1 50 | m_LightmapKeepShadowMask: 1 51 | m_LightmapKeepSubtractive: 1 52 | m_FogKeepLinear: 1 53 | m_FogKeepExp: 1 54 | m_FogKeepExp2: 1 55 | m_AlbedoSwatchInfos: [] 56 | m_LightsUseLinearIntensity: 0 57 | m_LightsUseColorTemperature: 0 58 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 20 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: bfcfc320427f8224bbb7a96f3d3aebad, 13 | type: 2} 14 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 15 7 | productGUID: 1a546f266b1f8eb448c31a3a1c183b4a 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: 2d-platformer 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 1 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | tizenShowActivityIndicatorOnLoading: -1 56 | iosAppInBackgroundBehavior: 0 57 | displayResolutionDialog: 1 58 | iosAllowHTTPDownload: 1 59 | allowedAutorotateToPortrait: 1 60 | allowedAutorotateToPortraitUpsideDown: 1 61 | allowedAutorotateToLandscapeRight: 1 62 | allowedAutorotateToLandscapeLeft: 1 63 | useOSAutorotation: 1 64 | use32BitDisplayBuffer: 1 65 | preserveFramebufferAlpha: 0 66 | disableDepthAndStencilBuffers: 0 67 | androidBlitType: 0 68 | defaultIsNativeResolution: 1 69 | macRetinaSupport: 1 70 | runInBackground: 1 71 | captureSingleScreen: 0 72 | muteOtherAudioSources: 0 73 | Prepare IOS For Recording: 0 74 | Force IOS Speakers When Recording: 0 75 | deferSystemGesturesMode: 0 76 | hideHomeButton: 0 77 | submitAnalytics: 1 78 | usePlayerLog: 1 79 | bakeCollisionMeshes: 0 80 | forceSingleInstance: 0 81 | resizableWindow: 0 82 | useMacAppStoreValidation: 0 83 | macAppStoreCategory: public.app-category.games 84 | gpuSkinning: 0 85 | graphicsJobs: 0 86 | xboxPIXTextureCapture: 0 87 | xboxEnableAvatar: 0 88 | xboxEnableKinect: 0 89 | xboxEnableKinectAutoTracking: 0 90 | xboxEnableFitness: 0 91 | visibleInBackground: 1 92 | allowFullscreenSwitch: 1 93 | graphicsJobMode: 0 94 | fullscreenMode: 1 95 | xboxSpeechDB: 0 96 | xboxEnableHeadOrientation: 0 97 | xboxEnableGuest: 0 98 | xboxEnablePIXSampling: 0 99 | metalFramebufferOnly: 0 100 | n3dsDisableStereoscopicView: 0 101 | n3dsEnableSharedListOpt: 1 102 | n3dsEnableVSync: 0 103 | xboxOneResolution: 0 104 | xboxOneSResolution: 0 105 | xboxOneXResolution: 3 106 | xboxOneMonoLoggingLevel: 0 107 | xboxOneLoggingLevel: 1 108 | xboxOneDisableEsram: 0 109 | xboxOnePresentImmediateThreshold: 0 110 | switchQueueCommandMemory: 0 111 | videoMemoryForVertexBuffers: 0 112 | psp2PowerMode: 0 113 | psp2AcquireBGM: 1 114 | m_SupportedAspectRatios: 115 | 4:3: 1 116 | 5:4: 1 117 | 16:10: 1 118 | 16:9: 1 119 | Others: 1 120 | bundleVersion: 0.1 121 | preloadedAssets: [] 122 | metroInputSource: 0 123 | wsaTransparentSwapchain: 0 124 | m_HolographicPauseOnTrackingLoss: 1 125 | xboxOneDisableKinectGpuReservation: 0 126 | xboxOneEnable7thCore: 0 127 | vrSettings: 128 | cardboard: 129 | depthFormat: 0 130 | enableTransitionView: 0 131 | daydream: 132 | depthFormat: 0 133 | useSustainedPerformanceMode: 0 134 | enableVideoLayer: 0 135 | useProtectedVideoMemory: 0 136 | minimumSupportedHeadTracking: 0 137 | maximumSupportedHeadTracking: 1 138 | hololens: 139 | depthFormat: 1 140 | depthBufferSharingEnabled: 0 141 | enable360StereoCapture: 0 142 | oculus: 143 | sharedDepthBuffer: 0 144 | dashSupport: 0 145 | protectGraphicsMemory: 0 146 | useHDRDisplay: 0 147 | m_ColorGamuts: 00000000 148 | targetPixelDensity: 30 149 | resolutionScalingMode: 0 150 | androidSupportedAspectRatio: 1 151 | androidMaxAspectRatio: 2.1 152 | applicationIdentifier: 153 | Standalone: com.Company.ProductName 154 | buildNumber: {} 155 | AndroidBundleVersionCode: 1 156 | AndroidMinSdkVersion: 16 157 | AndroidTargetSdkVersion: 0 158 | AndroidPreferredInstallLocation: 1 159 | aotOptions: 160 | stripEngineCode: 1 161 | iPhoneStrippingLevel: 0 162 | iPhoneScriptCallOptimization: 0 163 | ForceInternetPermission: 0 164 | ForceSDCardPermission: 0 165 | CreateWallpaper: 0 166 | APKExpansionFiles: 0 167 | keepLoadedShadersAlive: 0 168 | StripUnusedMeshComponents: 1 169 | VertexChannelCompressionMask: 4054 170 | iPhoneSdkVersion: 988 171 | iOSTargetOSVersionString: 8.0 172 | tvOSSdkVersion: 0 173 | tvOSRequireExtendedGameController: 0 174 | tvOSTargetOSVersionString: 9.0 175 | uIPrerenderedIcon: 0 176 | uIRequiresPersistentWiFi: 0 177 | uIRequiresFullScreen: 1 178 | uIStatusBarHidden: 1 179 | uIExitOnSuspend: 0 180 | uIStatusBarStyle: 0 181 | iPhoneSplashScreen: {fileID: 0} 182 | iPhoneHighResSplashScreen: {fileID: 0} 183 | iPhoneTallHighResSplashScreen: {fileID: 0} 184 | iPhone47inSplashScreen: {fileID: 0} 185 | iPhone55inPortraitSplashScreen: {fileID: 0} 186 | iPhone55inLandscapeSplashScreen: {fileID: 0} 187 | iPhone58inPortraitSplashScreen: {fileID: 0} 188 | iPhone58inLandscapeSplashScreen: {fileID: 0} 189 | iPadPortraitSplashScreen: {fileID: 0} 190 | iPadHighResPortraitSplashScreen: {fileID: 0} 191 | iPadLandscapeSplashScreen: {fileID: 0} 192 | iPadHighResLandscapeSplashScreen: {fileID: 0} 193 | appleTVSplashScreen: {fileID: 0} 194 | appleTVSplashScreen2x: {fileID: 0} 195 | tvOSSmallIconLayers: [] 196 | tvOSSmallIconLayers2x: [] 197 | tvOSLargeIconLayers: [] 198 | tvOSLargeIconLayers2x: [] 199 | tvOSTopShelfImageLayers: [] 200 | tvOSTopShelfImageLayers2x: [] 201 | tvOSTopShelfImageWideLayers: [] 202 | tvOSTopShelfImageWideLayers2x: [] 203 | iOSLaunchScreenType: 0 204 | iOSLaunchScreenPortrait: {fileID: 0} 205 | iOSLaunchScreenLandscape: {fileID: 0} 206 | iOSLaunchScreenBackgroundColor: 207 | serializedVersion: 2 208 | rgba: 0 209 | iOSLaunchScreenFillPct: 100 210 | iOSLaunchScreenSize: 100 211 | iOSLaunchScreenCustomXibPath: 212 | iOSLaunchScreeniPadType: 0 213 | iOSLaunchScreeniPadImage: {fileID: 0} 214 | iOSLaunchScreeniPadBackgroundColor: 215 | serializedVersion: 2 216 | rgba: 0 217 | iOSLaunchScreeniPadFillPct: 100 218 | iOSLaunchScreeniPadSize: 100 219 | iOSLaunchScreeniPadCustomXibPath: 220 | iOSUseLaunchScreenStoryboard: 0 221 | iOSLaunchScreenCustomStoryboardPath: 222 | iOSDeviceRequirements: [] 223 | iOSURLSchemes: [] 224 | iOSBackgroundModes: 0 225 | iOSMetalForceHardShadows: 0 226 | metalEditorSupport: 1 227 | metalAPIValidation: 1 228 | iOSRenderExtraFrameOnPause: 0 229 | appleDeveloperTeamID: 230 | iOSManualSigningProvisioningProfileID: 231 | tvOSManualSigningProvisioningProfileID: 232 | appleEnableAutomaticSigning: 0 233 | iOSRequireARKit: 0 234 | appleEnableProMotion: 0 235 | clonedFromGUID: fe97a795c6621624a9fc94fd2443b1a8 236 | templatePackageId: com.unity.template.2d@1.0.0 237 | templateDefaultScene: Assets/Scenes/SampleScene.unity 238 | AndroidTargetArchitectures: 5 239 | AndroidSplashScreenScale: 0 240 | androidSplashScreen: {fileID: 0} 241 | AndroidKeystoreName: 242 | AndroidKeyaliasName: 243 | AndroidTVCompatibility: 1 244 | AndroidIsGame: 1 245 | AndroidEnableTango: 0 246 | androidEnableBanner: 1 247 | androidUseLowAccuracyLocation: 0 248 | m_AndroidBanners: 249 | - width: 320 250 | height: 180 251 | banner: {fileID: 0} 252 | androidGamepadSupportLevel: 0 253 | resolutionDialogBanner: {fileID: 0} 254 | m_BuildTargetIcons: [] 255 | m_BuildTargetPlatformIcons: [] 256 | m_BuildTargetBatching: [] 257 | m_BuildTargetGraphicsAPIs: [] 258 | m_BuildTargetVRSettings: [] 259 | m_BuildTargetEnableVuforiaSettings: [] 260 | openGLRequireES31: 0 261 | openGLRequireES31AEP: 0 262 | m_TemplateCustomTags: {} 263 | mobileMTRendering: 264 | Android: 1 265 | iPhone: 1 266 | tvOS: 1 267 | m_BuildTargetGroupLightmapEncodingQuality: [] 268 | playModeTestRunnerEnabled: 0 269 | runPlayModeTestAsEditModeTest: 0 270 | actionOnDotNetUnhandledException: 1 271 | enableInternalProfiler: 0 272 | logObjCUncaughtExceptions: 1 273 | enableCrashReportAPI: 0 274 | cameraUsageDescription: 275 | locationUsageDescription: 276 | microphoneUsageDescription: 277 | switchNetLibKey: 278 | switchSocketMemoryPoolSize: 6144 279 | switchSocketAllocatorPoolSize: 128 280 | switchSocketConcurrencyLimit: 14 281 | switchScreenResolutionBehavior: 2 282 | switchUseCPUProfiler: 0 283 | switchApplicationID: 0x01004b9000490000 284 | switchNSODependencies: 285 | switchTitleNames_0: 286 | switchTitleNames_1: 287 | switchTitleNames_2: 288 | switchTitleNames_3: 289 | switchTitleNames_4: 290 | switchTitleNames_5: 291 | switchTitleNames_6: 292 | switchTitleNames_7: 293 | switchTitleNames_8: 294 | switchTitleNames_9: 295 | switchTitleNames_10: 296 | switchTitleNames_11: 297 | switchTitleNames_12: 298 | switchTitleNames_13: 299 | switchTitleNames_14: 300 | switchPublisherNames_0: 301 | switchPublisherNames_1: 302 | switchPublisherNames_2: 303 | switchPublisherNames_3: 304 | switchPublisherNames_4: 305 | switchPublisherNames_5: 306 | switchPublisherNames_6: 307 | switchPublisherNames_7: 308 | switchPublisherNames_8: 309 | switchPublisherNames_9: 310 | switchPublisherNames_10: 311 | switchPublisherNames_11: 312 | switchPublisherNames_12: 313 | switchPublisherNames_13: 314 | switchPublisherNames_14: 315 | switchIcons_0: {fileID: 0} 316 | switchIcons_1: {fileID: 0} 317 | switchIcons_2: {fileID: 0} 318 | switchIcons_3: {fileID: 0} 319 | switchIcons_4: {fileID: 0} 320 | switchIcons_5: {fileID: 0} 321 | switchIcons_6: {fileID: 0} 322 | switchIcons_7: {fileID: 0} 323 | switchIcons_8: {fileID: 0} 324 | switchIcons_9: {fileID: 0} 325 | switchIcons_10: {fileID: 0} 326 | switchIcons_11: {fileID: 0} 327 | switchIcons_12: {fileID: 0} 328 | switchIcons_13: {fileID: 0} 329 | switchIcons_14: {fileID: 0} 330 | switchSmallIcons_0: {fileID: 0} 331 | switchSmallIcons_1: {fileID: 0} 332 | switchSmallIcons_2: {fileID: 0} 333 | switchSmallIcons_3: {fileID: 0} 334 | switchSmallIcons_4: {fileID: 0} 335 | switchSmallIcons_5: {fileID: 0} 336 | switchSmallIcons_6: {fileID: 0} 337 | switchSmallIcons_7: {fileID: 0} 338 | switchSmallIcons_8: {fileID: 0} 339 | switchSmallIcons_9: {fileID: 0} 340 | switchSmallIcons_10: {fileID: 0} 341 | switchSmallIcons_11: {fileID: 0} 342 | switchSmallIcons_12: {fileID: 0} 343 | switchSmallIcons_13: {fileID: 0} 344 | switchSmallIcons_14: {fileID: 0} 345 | switchManualHTML: 346 | switchAccessibleURLs: 347 | switchLegalInformation: 348 | switchMainThreadStackSize: 1048576 349 | switchPresenceGroupId: 350 | switchLogoHandling: 0 351 | switchReleaseVersion: 0 352 | switchDisplayVersion: 1.0.0 353 | switchStartupUserAccount: 0 354 | switchTouchScreenUsage: 0 355 | switchSupportedLanguagesMask: 0 356 | switchLogoType: 0 357 | switchApplicationErrorCodeCategory: 358 | switchUserAccountSaveDataSize: 0 359 | switchUserAccountSaveDataJournalSize: 0 360 | switchApplicationAttribute: 0 361 | switchCardSpecSize: -1 362 | switchCardSpecClock: -1 363 | switchRatingsMask: 0 364 | switchRatingsInt_0: 0 365 | switchRatingsInt_1: 0 366 | switchRatingsInt_2: 0 367 | switchRatingsInt_3: 0 368 | switchRatingsInt_4: 0 369 | switchRatingsInt_5: 0 370 | switchRatingsInt_6: 0 371 | switchRatingsInt_7: 0 372 | switchRatingsInt_8: 0 373 | switchRatingsInt_9: 0 374 | switchRatingsInt_10: 0 375 | switchRatingsInt_11: 0 376 | switchLocalCommunicationIds_0: 377 | switchLocalCommunicationIds_1: 378 | switchLocalCommunicationIds_2: 379 | switchLocalCommunicationIds_3: 380 | switchLocalCommunicationIds_4: 381 | switchLocalCommunicationIds_5: 382 | switchLocalCommunicationIds_6: 383 | switchLocalCommunicationIds_7: 384 | switchParentalControl: 0 385 | switchAllowsScreenshot: 1 386 | switchAllowsVideoCapturing: 1 387 | switchAllowsRuntimeAddOnContentInstall: 0 388 | switchDataLossConfirmation: 0 389 | switchSupportedNpadStyles: 3 390 | switchSocketConfigEnabled: 0 391 | switchTcpInitialSendBufferSize: 32 392 | switchTcpInitialReceiveBufferSize: 64 393 | switchTcpAutoSendBufferSizeMax: 256 394 | switchTcpAutoReceiveBufferSizeMax: 256 395 | switchUdpSendBufferSize: 9 396 | switchUdpReceiveBufferSize: 42 397 | switchSocketBufferEfficiency: 4 398 | switchSocketInitializeEnabled: 1 399 | switchNetworkInterfaceManagerInitializeEnabled: 1 400 | switchPlayerConnectionEnabled: 1 401 | ps4NPAgeRating: 12 402 | ps4NPTitleSecret: 403 | ps4NPTrophyPackPath: 404 | ps4ParentalLevel: 11 405 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 406 | ps4Category: 0 407 | ps4MasterVersion: 01.00 408 | ps4AppVersion: 01.00 409 | ps4AppType: 0 410 | ps4ParamSfxPath: 411 | ps4VideoOutPixelFormat: 0 412 | ps4VideoOutInitialWidth: 1920 413 | ps4VideoOutBaseModeInitialWidth: 1920 414 | ps4VideoOutReprojectionRate: 60 415 | ps4PronunciationXMLPath: 416 | ps4PronunciationSIGPath: 417 | ps4BackgroundImagePath: 418 | ps4StartupImagePath: 419 | ps4StartupImagesFolder: 420 | ps4IconImagesFolder: 421 | ps4SaveDataImagePath: 422 | ps4SdkOverride: 423 | ps4BGMPath: 424 | ps4ShareFilePath: 425 | ps4ShareOverlayImagePath: 426 | ps4PrivacyGuardImagePath: 427 | ps4NPtitleDatPath: 428 | ps4RemotePlayKeyAssignment: -1 429 | ps4RemotePlayKeyMappingDir: 430 | ps4PlayTogetherPlayerCount: 0 431 | ps4EnterButtonAssignment: 1 432 | ps4ApplicationParam1: 0 433 | ps4ApplicationParam2: 0 434 | ps4ApplicationParam3: 0 435 | ps4ApplicationParam4: 0 436 | ps4DownloadDataSize: 0 437 | ps4GarlicHeapSize: 2048 438 | ps4ProGarlicHeapSize: 2560 439 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 440 | ps4pnSessions: 1 441 | ps4pnPresence: 1 442 | ps4pnFriends: 1 443 | ps4pnGameCustomData: 1 444 | playerPrefsSupport: 0 445 | enableApplicationExit: 0 446 | restrictedAudioUsageRights: 0 447 | ps4UseResolutionFallback: 0 448 | ps4ReprojectionSupport: 0 449 | ps4UseAudio3dBackend: 0 450 | ps4SocialScreenEnabled: 0 451 | ps4ScriptOptimizationLevel: 0 452 | ps4Audio3dVirtualSpeakerCount: 14 453 | ps4attribCpuUsage: 0 454 | ps4PatchPkgPath: 455 | ps4PatchLatestPkgPath: 456 | ps4PatchChangeinfoPath: 457 | ps4PatchDayOne: 0 458 | ps4attribUserManagement: 0 459 | ps4attribMoveSupport: 0 460 | ps4attrib3DSupport: 0 461 | ps4attribShareSupport: 0 462 | ps4attribExclusiveVR: 0 463 | ps4disableAutoHideSplash: 0 464 | ps4videoRecordingFeaturesUsed: 0 465 | ps4contentSearchFeaturesUsed: 0 466 | ps4attribEyeToEyeDistanceSettingVR: 0 467 | ps4IncludedModules: [] 468 | monoEnv: 469 | psp2Splashimage: {fileID: 0} 470 | psp2NPTrophyPackPath: 471 | psp2NPSupportGBMorGJP: 0 472 | psp2NPAgeRating: 12 473 | psp2NPTitleDatPath: 474 | psp2NPCommsID: 475 | psp2NPCommunicationsID: 476 | psp2NPCommsPassphrase: 477 | psp2NPCommsSig: 478 | psp2ParamSfxPath: 479 | psp2ManualPath: 480 | psp2LiveAreaGatePath: 481 | psp2LiveAreaBackroundPath: 482 | psp2LiveAreaPath: 483 | psp2LiveAreaTrialPath: 484 | psp2PatchChangeInfoPath: 485 | psp2PatchOriginalPackage: 486 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 487 | psp2KeystoneFile: 488 | psp2MemoryExpansionMode: 0 489 | psp2DRMType: 0 490 | psp2StorageType: 0 491 | psp2MediaCapacity: 0 492 | psp2DLCConfigPath: 493 | psp2ThumbnailPath: 494 | psp2BackgroundPath: 495 | psp2SoundPath: 496 | psp2TrophyCommId: 497 | psp2TrophyPackagePath: 498 | psp2PackagedResourcesPath: 499 | psp2SaveDataQuota: 10240 500 | psp2ParentalLevel: 1 501 | psp2ShortTitle: Not Set 502 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 503 | psp2Category: 0 504 | psp2MasterVersion: 01.00 505 | psp2AppVersion: 01.00 506 | psp2TVBootMode: 0 507 | psp2EnterButtonAssignment: 2 508 | psp2TVDisableEmu: 0 509 | psp2AllowTwitterDialog: 1 510 | psp2Upgradable: 0 511 | psp2HealthWarning: 0 512 | psp2UseLibLocation: 0 513 | psp2InfoBarOnStartup: 0 514 | psp2InfoBarColor: 0 515 | psp2ScriptOptimizationLevel: 0 516 | splashScreenBackgroundSourceLandscape: {fileID: 0} 517 | splashScreenBackgroundSourcePortrait: {fileID: 0} 518 | spritePackerPolicy: 519 | webGLMemorySize: 256 520 | webGLExceptionSupport: 1 521 | webGLNameFilesAsHashes: 0 522 | webGLDataCaching: 0 523 | webGLDebugSymbols: 0 524 | webGLEmscriptenArgs: 525 | webGLModulesDirectory: 526 | webGLTemplate: APPLICATION:Default 527 | webGLAnalyzeBuildSize: 0 528 | webGLUseEmbeddedResources: 0 529 | webGLCompressionFormat: 1 530 | webGLLinkerTarget: 0 531 | scriptingDefineSymbols: {} 532 | platformArchitecture: {} 533 | scriptingBackend: {} 534 | il2cppCompilerConfiguration: {} 535 | incrementalIl2cppBuild: {} 536 | allowUnsafeCode: 1 537 | additionalIl2CppArgs: 538 | scriptingRuntimeVersion: 1 539 | apiCompatibilityLevelPerPlatform: {} 540 | m_RenderingPath: 1 541 | m_MobileRenderingPath: 1 542 | metroPackageName: Template_2D 543 | metroPackageVersion: 544 | metroCertificatePath: 545 | metroCertificatePassword: 546 | metroCertificateSubject: 547 | metroCertificateIssuer: 548 | metroCertificateNotAfter: 0000000000000000 549 | metroApplicationDescription: Template_2D 550 | wsaImages: {} 551 | metroTileShortName: 552 | metroCommandLineArgsFile: 553 | metroTileShowName: 0 554 | metroMediumTileShowName: 0 555 | metroLargeTileShowName: 0 556 | metroWideTileShowName: 0 557 | metroDefaultTileSize: 1 558 | metroTileForegroundText: 2 559 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 560 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 561 | a: 1} 562 | metroSplashScreenUseBackgroundColor: 0 563 | platformCapabilities: {} 564 | metroFTAName: 565 | metroFTAFileTypes: [] 566 | metroProtocolName: 567 | metroCompilationOverrides: 1 568 | tizenProductDescription: 569 | tizenProductURL: 570 | tizenSigningProfileName: 571 | tizenGPSPermissions: 0 572 | tizenMicrophonePermissions: 0 573 | tizenDeploymentTarget: 574 | tizenDeploymentTargetType: -1 575 | tizenMinOSVersion: 1 576 | n3dsUseExtSaveData: 0 577 | n3dsCompressStaticMem: 1 578 | n3dsExtSaveDataNumber: 0x12345 579 | n3dsStackSize: 131072 580 | n3dsTargetPlatform: 2 581 | n3dsRegion: 7 582 | n3dsMediaSize: 0 583 | n3dsLogoStyle: 3 584 | n3dsTitle: GameName 585 | n3dsProductCode: 586 | n3dsApplicationId: 0xFF3FF 587 | XboxOneProductId: 588 | XboxOneUpdateKey: 589 | XboxOneSandboxId: 590 | XboxOneContentId: 591 | XboxOneTitleId: 592 | XboxOneSCId: 593 | XboxOneGameOsOverridePath: 594 | XboxOnePackagingOverridePath: 595 | XboxOneAppManifestOverridePath: 596 | XboxOnePackageEncryption: 0 597 | XboxOnePackageUpdateGranularity: 2 598 | XboxOneDescription: 599 | XboxOneLanguage: 600 | - enus 601 | XboxOneCapability: [] 602 | XboxOneGameRating: {} 603 | XboxOneIsContentPackage: 0 604 | XboxOneEnableGPUVariability: 0 605 | XboxOneSockets: {} 606 | XboxOneSplashScreen: {fileID: 0} 607 | XboxOneAllowedProductIds: [] 608 | XboxOnePersistentLocalStorageSize: 0 609 | XboxOneXTitleMemory: 8 610 | xboxOneScriptCompiler: 0 611 | vrEditorSettings: 612 | daydream: 613 | daydreamIconForeground: {fileID: 0} 614 | daydreamIconBackground: {fileID: 0} 615 | cloudServicesEnabled: 616 | UNet: 1 617 | facebookSdkVersion: 7.9.4 618 | apiCompatibilityLevel: 3 619 | cloudProjectId: 620 | projectName: Template_2D 621 | organizationId: 622 | cloudEnabled: 0 623 | enableNativePlatformBackendsForNewInputSystem: 0 624 | disableOldInputManagerSupport: 0 625 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.2.14f1 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 3 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 0 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 0 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 0 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 0 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 0 112 | billboardsFaceCameraPosition: 0 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 0 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 0 136 | antiAliasing: 0 137 | softParticles: 0 138 | softVegetation: 1 139 | realtimeReflectionProbes: 0 140 | billboardsFaceCameraPosition: 0 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 0 153 | shadowResolution: 0 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 0 164 | antiAliasing: 0 165 | softParticles: 0 166 | softVegetation: 1 167 | realtimeReflectionProbes: 0 168 | billboardsFaceCameraPosition: 0 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.0167 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 1 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Instanced Sprite Renderer for Unity's ECS 2 | 3 | This project is a simple example of how Unity's new Entity Component System (ECS) in 2018.1.14f1 can be used to create a performant instanced sprite renderer. Find out about the [new ECS in Unity here](https://github.com/Unity-Technologies/EntityComponentSystemSamples). 4 | 5 | The assets used in the example are from [Kenney's Animal Pack](https://kenney.nl/). 6 | Thanks to [@Shinao](https://www.reddit.com/user/Shinao) for the help. 7 | 8 | ## Quick Start 9 | 1. Make sure you have [this version of Unity 2018.1.0b12](https://beta.unity3d.com/download/ed1bf90b40e6/public_download.html) installed 10 | 2. Make sure the manifest.json file located at `.../[PROJECT FOLDER]/Packages/manifest.json` looks like this: 11 | ``` 12 | { 13 | "dependencies": { 14 | "com.unity.entities": "0.0.12-preview.19", 15 | "com.unity.package-manager-ui": "1.9.11", 16 | "com.unity.modules.ui": "1.0.0" 17 | }, 18 | "testables": [ 19 | "com.unity.collections", 20 | "com.unity.entities", 21 | "com.unity.jobs" 22 | ], 23 | } 24 | ``` 25 | 3. Download [this .unitypackage file](https://github.com/toinfiniityandbeyond/ecs-instanced-sprite-renderer/releases/download/0.2/ECS.Instanced.Sprite.Renderer.unitypackage) and import it. 26 | 4. Open **SpriteRendererScene** and press play. 27 | 28 | ## How it Works 29 | By adding `SpriteInstanceRenderer` to an entity it is rendered using its `Position` and `Rotation` as a quad with a texture on it. The `SpriteInstanceRender` inherits `ISharedComponentData` meaning any entity using same instance of will be drawn in one draw call. This is possible because of [Graphics.DrawMeshInstanced](https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstanced.html) method. In the Example Scene included, 10,000 sprites are drawn. However the before mentioned method only draws a maximum of 1023 instances at once, so it splits up into as many groups necessary to draw all the instances. 30 | 31 | ## Limitations 32 | * No way to push the matrices from a job 33 | * No NativeArray API, currently uses `Matrix4x4[]` 34 | 35 | As a result this code is not yet jobified. For now, we have to copy our data into Matrix4x4[] with a specific upper limit of how many instances we can render in one batch. 36 | --------------------------------------------------------------------------------