├── Assets
├── Runtime
│ ├── Scripts
│ │ ├── Render
│ │ │ ├── RenderGroup
│ │ │ │ ├── Components
│ │ │ │ │ ├── SpriteSheetAnimationDefinitionComponent.cs
│ │ │ │ │ ├── RenderGroupComponents.cs.meta
│ │ │ │ │ ├── SpriteSheetAnimationDefinitionComponent.cs.meta
│ │ │ │ │ └── RenderGroupComponents.cs
│ │ │ │ ├── Components.meta
│ │ │ │ ├── RenderGroup.cs.meta
│ │ │ │ ├── ColorBufferSystem.cs.meta
│ │ │ │ ├── MatrixBufferSystem.cs.meta
│ │ │ │ ├── SpriteSheetUvSystem.cs.meta
│ │ │ │ ├── MatrixBufferSystem.cs
│ │ │ │ ├── SpriteSheetUvSystem.cs
│ │ │ │ ├── ColorBufferSystem.cs
│ │ │ │ └── RenderGroup.cs
│ │ │ ├── RenderGroup.meta
│ │ │ ├── SpriteSheetCache.cs.meta
│ │ │ ├── RenderInformation.cs.meta
│ │ │ ├── SpriteSheetRenderSystem.cs.meta
│ │ │ ├── RenderInformation.cs
│ │ │ ├── SpriteSheetCache.cs
│ │ │ └── SpriteSheetRenderSystem.cs
│ │ ├── Animation.meta
│ │ ├── Render.meta
│ │ ├── Animation
│ │ │ ├── Components.meta
│ │ │ ├── Components
│ │ │ │ ├── SpriteSheetAnimationComponents.cs.meta
│ │ │ │ ├── SpriteSheetAnimationChangeCommand.cs.meta
│ │ │ │ ├── SpriteSheetAnimationChangeCommand.cs
│ │ │ │ └── SpriteSheetAnimationComponents.cs
│ │ │ ├── SpriteSheetAnimationDeferredChangeSystem.cs.meta
│ │ │ ├── SpriteSheetAnimationSystem.cs.meta
│ │ │ ├── SpriteSheetAnimationDeferredChangeSystem.cs
│ │ │ └── SpriteSheetAnimationSystem.cs
│ │ ├── SpriteSheetFactory.cs.meta
│ │ ├── ScriptableObject
│ │ │ ├── StaticSpriteScriptable.cs.meta
│ │ │ ├── SpriteSheetAnimator.cs.meta
│ │ │ ├── SpriteSheetAnimationScriptable.cs.meta
│ │ │ ├── StaticSpriteScriptable.cs
│ │ │ ├── SpriteSheetAnimator.cs
│ │ │ └── SpriteSheetAnimationScriptable.cs
│ │ ├── Utils.meta
│ │ ├── Utils
│ │ │ ├── DOTS.meta
│ │ │ ├── Render.meta
│ │ │ ├── TMUtilsEcs.meta
│ │ │ ├── TMUtilsEcs
│ │ │ │ ├── DOTS.meta
│ │ │ │ ├── Float2V.cs.meta
│ │ │ │ ├── Float3V.cs.meta
│ │ │ │ ├── EcsSystemUtils.cs.meta
│ │ │ │ ├── Entity3DFactory.cs.meta
│ │ │ │ ├── EntityDefinition.cs.meta
│ │ │ │ ├── ComponentReference.cs.meta
│ │ │ │ ├── DOTS
│ │ │ │ │ ├── DotsDebugUtils.cs.meta
│ │ │ │ │ ├── DotsCollectionUtils.cs.meta
│ │ │ │ │ ├── DotsCollectionsToString.cs.meta
│ │ │ │ │ ├── EntityManagerNameExtensions.cs.meta
│ │ │ │ │ ├── DotsCollectionsToString.cs
│ │ │ │ │ ├── EntityManagerNameExtensions.cs
│ │ │ │ │ └── DotsDebugUtils.cs
│ │ │ │ ├── Float2V.cs
│ │ │ │ ├── Float3V.cs
│ │ │ │ ├── EntityDefinition.cs
│ │ │ │ ├── ComponentReference.cs
│ │ │ │ ├── EcsSystemUtils.cs
│ │ │ │ └── Entity3DFactory.cs
│ │ │ ├── SerializableNullable.cs
│ │ │ ├── CollectionUtils.cs.meta
│ │ │ ├── EntitySpawner.cs.meta
│ │ │ ├── SingletonBase.cs.meta
│ │ │ ├── Render
│ │ │ │ ├── MeshExtension.cs.meta
│ │ │ │ ├── ShaderDebug.cs.meta
│ │ │ │ ├── ShaderDebugBuffer.cs.meta
│ │ │ │ ├── ShaderDebugBuffer.cs
│ │ │ │ ├── MeshExtension.cs
│ │ │ │ └── ShaderDebug.cs
│ │ │ ├── SerializableNullable.cs.meta
│ │ │ ├── SingletonBase.cs
│ │ │ ├── EntitySpawner.cs
│ │ │ └── CollectionUtils.cs
│ │ ├── ScriptableObject.meta
│ │ ├── SpriteSheetRenderer.asmdef.meta
│ │ ├── SpriteSheetRendererInit.cs.meta
│ │ ├── SpriteSheetRenderer.asmdef
│ │ ├── SpriteSheetRendererInit.cs
│ │ └── SpriteSheetFactory.cs
│ ├── Sprites
│ │ ├── atlas.png
│ │ ├── EmojiOne 1.png
│ │ ├── characters.png
│ │ ├── hit.asset.meta
│ │ ├── jump.asset.meta
│ │ ├── run.asset.meta
│ │ ├── slash.asset.meta
│ │ ├── jump_bk.asset.meta
│ │ ├── square.asset.meta
│ │ ├── CharacterAnimator.asset.meta
│ │ ├── Atlas.spriteatlas.meta
│ │ ├── CharacterAnimator.asset
│ │ ├── hit.asset
│ │ ├── jump.asset
│ │ ├── slash.asset
│ │ ├── jump_bk.asset
│ │ ├── square.asset
│ │ └── run.asset
│ ├── AnimationScriptable.png
│ ├── Plugins
│ │ ├── NSubstitute.dll
│ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ ├── System.Runtime.CompilerServices.Unsafe.dll.meta
│ │ └── NSubstitute.dll.meta
│ ├── Examples
│ │ ├── DynamicAnimations[DEMO]
│ │ │ ├── Scripts
│ │ │ │ ├── DynamicAnimationsDemoBaker.cs.meta
│ │ │ │ ├── GUIHelper.cs.meta
│ │ │ │ ├── SpriteMovement.cs.meta
│ │ │ │ ├── DynamicAnimationsDemoInit.cs.meta
│ │ │ │ ├── GUIHelper.cs
│ │ │ │ ├── SpriteMovement.cs
│ │ │ │ ├── DynamicAnimationsDemoInit.cs
│ │ │ │ └── DynamicAnimationsDemoBaker.cs
│ │ │ ├── DynamicAnimationScene.unity.meta
│ │ │ ├── Scripts.meta
│ │ │ ├── DynamicAnimationScene.meta
│ │ │ └── DynamicAnimationScene
│ │ │ │ ├── New Sub Scene.unity.meta
│ │ │ │ └── New Sub Scene.unity
│ │ ├── BulkSpawnSprites[DEMO]
│ │ │ ├── Spritesheet
│ │ │ │ ├── 1bit-kennynl.png
│ │ │ │ ├── License.txt.meta
│ │ │ │ └── License.txt
│ │ │ ├── SpawnSpritesTest.unity.meta
│ │ │ ├── Scripts.meta
│ │ │ ├── Spritesheet.meta
│ │ │ ├── SpawnSpritesTestSettings.lighting.meta
│ │ │ ├── Scripts
│ │ │ │ ├── MakeSpriteEntities.cs.meta
│ │ │ │ └── MakeSpriteEntities.cs
│ │ │ └── SpawnSpritesTestSettings.lighting
│ │ ├── SingleEntityDestroy[DEMO]
│ │ │ ├── Scripts
│ │ │ │ ├── LifeTime.cs
│ │ │ │ ├── LifeTime.cs.meta
│ │ │ │ ├── SingleEntityDestroy.cs.meta
│ │ │ │ ├── SpriteManagerSystem.cs.meta
│ │ │ │ ├── SpriteManagerSystem.cs
│ │ │ │ └── SingleEntityDestroy.cs
│ │ │ ├── SingleEntityDestroy.unity.meta
│ │ │ └── Scripts.meta
│ │ ├── BulkSpawnSprites[DEMO].meta
│ │ ├── DynamicAnimations[DEMO].meta
│ │ ├── SingleEntityDestroy[DEMO].meta
│ │ ├── SingleSpawnSprite[DEMO].meta
│ │ ├── SingleSpawnSprite[DEMO]
│ │ │ ├── SingleSpawner.unity.meta
│ │ │ ├── Script.meta
│ │ │ └── Script
│ │ │ │ ├── SingleSpriteSheetSpawner.cs.meta
│ │ │ │ └── SingleSpriteSheetSpawner.cs
│ │ ├── SpriteSheetRendererExamples.asmdef.meta
│ │ ├── CameraZoom.cs.meta
│ │ ├── CameraController.cs.meta
│ │ ├── CameraZoom.cs
│ │ ├── SpriteSheetRendererExamples.asmdef
│ │ └── CameraController.cs
│ ├── LICENSE.txt.meta
│ ├── README.md.meta
│ ├── scene.unity.meta
│ ├── package.json.meta
│ ├── Examples.meta
│ ├── Material.meta
│ ├── Plugins.meta
│ ├── Scripts.meta
│ ├── Sprites.meta
│ ├── Material
│ │ ├── SpriteSheetMaterial.mat.meta
│ │ ├── SpriteSheet.shader.meta
│ │ ├── SpriteSheetMaterial.mat
│ │ └── SpriteSheet.shader
│ ├── LICENSE.txt
│ ├── MY_PACKAGE_SCRIPT.cs.meta
│ ├── MY_PACKAGE_SCRIPT.cs
│ ├── package.json
│ ├── AnimationScriptable.png.meta
│ ├── README.md
│ └── scene.unity
├── package.json.meta
├── Editor.meta
├── Runtime.meta
├── Scenes.meta
└── package.json
├── ProjectSettings
├── ProjectVersion.txt
├── ClusterInputManager.asset
├── PresetManager.asset
├── NetworkManager.asset
├── XRSettings.asset
├── VersionControlSettings.asset
├── TimeManager.asset
├── EditorBuildSettings.asset
├── VFXManager.asset
├── AudioManager.asset
├── EntitiesClientSettings.asset
├── TagManager.asset
├── UnityConnectSettings.asset
├── PackageManagerSettings.asset
├── MemorySettings.asset
├── DynamicsManager.asset
├── EditorSettings.asset
├── NavMeshAreas.asset
├── Physics2DSettings.asset
├── GraphicsSettings.asset
├── SceneTemplateSettings.json
└── QualitySettings.asset
├── RepositoryMetadata
└── AnimationScriptable.png
├── .idea
├── .idea.Package-Template
│ └── .idea
│ │ ├── encodings.xml
│ │ ├── vcs.xml
│ │ ├── indexLayout.xml
│ │ └── .gitignore
└── .idea.SpriteSheetRenderer_Templated
│ └── .idea
│ ├── encodings.xml
│ ├── vcs.xml
│ ├── indexLayout.xml
│ └── .gitignore
├── .gitattributes
├── Assembly-CSharp.csproj.DotSettings
├── Packages
├── manifest.json
└── packages-lock.json
├── SpriteSheetRendererExamples.csproj.DotSettings
├── SpriteSheetRenderer.csproj.DotSettings
├── .gitignore
└── README.md
/Assets/Runtime/Scripts/Render/RenderGroup/Components/SpriteSheetAnimationDefinitionComponent.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8b7f451d5bd04f5aa762e15b8c5f23b8
3 | timeCreated: 1642166242
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7ee31bc3ce9b4000b3d83e76bfb126f7
3 | timeCreated: 1642166430
--------------------------------------------------------------------------------
/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2022.2.0f1
2 | m_EditorVersionWithRevision: 2022.2.0f1 (35dcd44975df)
3 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 86ff286085e44bb591bfe3fdc79bb0bd
3 | timeCreated: 1642166186
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/atlas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/Sprites/atlas.png
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/Components.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c0c418a28e784ec1a0d570fb52506ea9
3 | timeCreated: 1642166380
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/SpriteSheetFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b44c7d1b98fe4200bc62bea161ead0f3
3 | timeCreated: 1642761408
--------------------------------------------------------------------------------
/Assets/Runtime/AnimationScriptable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/AnimationScriptable.png
--------------------------------------------------------------------------------
/Assets/Runtime/Plugins/NSubstitute.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/Plugins/NSubstitute.dll
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/Components.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0fc52359d5ad456ea3629ef4d2e6152a
3 | timeCreated: 1642166327
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/EmojiOne 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/Sprites/EmojiOne 1.png
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/characters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/Sprites/characters.png
--------------------------------------------------------------------------------
/RepositoryMetadata/AnimationScriptable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/RepositoryMetadata/AnimationScriptable.png
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject/StaticSpriteScriptable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9f40607884564ba999814723c3916ae6
3 | timeCreated: 1642762210
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/Components/SpriteSheetAnimationComponents.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 457c6e3054fc4beba0ed1dad3ddfdd91
3 | timeCreated: 1642166529
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/SpriteSheetAnimationDeferredChangeSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6bd3822c79a24f46bda4a7d579a7ea6e
3 | timeCreated: 1642166102
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/Components/RenderGroupComponents.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e40649d29b23467486915f61866e1304
3 | timeCreated: 1642289781
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/Components/SpriteSheetAnimationChangeCommand.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 14f5c33115a943f286ea9ea56dfc215b
3 | timeCreated: 1642166603
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/DynamicAnimationsDemoBaker.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 13d9c970cb7c436ab06534803747fb49
3 | timeCreated: 1670191165
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/Components/SpriteSheetAnimationDefinitionComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0022216f51d241dab6674ad0a947d4d4
3 | timeCreated: 1641852945
--------------------------------------------------------------------------------
/Assets/Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll
--------------------------------------------------------------------------------
/Assets/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 70b6ea04738cd4a88869322662e8a62e
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/LICENSE.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5114a6058142a604cb3ac1226e34b708
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/README.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0f1c13ab5b67dca4ba150b66081cee5a
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c8555ab5916504baaa1c6fa607734297
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/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 | serializedVersion: 2
7 | m_DefaultPresets: {}
8 |
--------------------------------------------------------------------------------
/Assets/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 320d65e0c4f7a47f58f3eb0dabb98329
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c936871dcd1c74e27b7b5144c79ef53b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Spritesheet/1bit-kennynl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarasMartynyuk/SpriteSheetRenderer/HEAD/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Spritesheet/1bit-kennynl.png
--------------------------------------------------------------------------------
/Assets/Runtime/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 36b416e7ffc22704b8acc6efbdc9a4bf
3 | PackageManifestImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6e901d76a4d1649a19f7cccd2c22cceb
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts/LifeTime.cs:
--------------------------------------------------------------------------------
1 | using Unity.Entities;
2 |
3 | namespace SpriteSheetRendererExamples
4 | {
5 | public struct LifeTime : IComponentData {
6 | public float Value;
7 | }
8 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.idea/.idea.Package-Template/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a6bda6c947a910d41ada13e55294162c
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Material.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d74aee63ab7026840bb82877186cdfad
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0e4e3d2d54a04b04e914964551815ddc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 68ac37dfe47362441860748fdb1f090b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 551bb5003a0360141a7d093d31bb0923
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8f5f1d3ac2f2505499abd224fca1518b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Collapse Unity-generated files on GitHub
2 | *.asset linguist-generated
3 | *.mat linguist-generated
4 | *.meta linguist-generated
5 | *.prefab linguist-generated
6 | *.unity linguist-generated
7 | *.svg linguist-generated
8 |
--------------------------------------------------------------------------------
/.idea/.idea.Package-Template/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/.idea.SpriteSheetRenderer_Templated/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/DOTS.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c4244720212ae4173b9b48541729b99d
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tm.spritesheetrenderer",
3 | "displayName": "SpriteSheetRenderer",
4 | "unity": "2022.2",
5 | "description": "SpriteSheetRenderer",
6 | "version": "1.0.0",
7 | "dependencies": {
8 | }
9 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5f106b3e8d76ff24b9745fa75e86abe1
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/SpriteSheetRenderer.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6a7691b896cc8ad4ca5aa9883d9c4e19
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a580b195463ff4f138af123e021ebe20
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d860df6b6b178479b89cb27b7c9e9406
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/ProjectSettings/XRSettings.asset:
--------------------------------------------------------------------------------
1 | {
2 | "m_SettingKeys": [
3 | "VR Device Disabled",
4 | "VR Device User Alert"
5 | ],
6 | "m_SettingValues": [
7 | "False",
8 | "False"
9 | ]
10 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d9fd48535bd9349639b8b7cfa915c58a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/hit.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5602bbe2cc4159040b5fb93b1abfc81c
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/jump.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5237657b6a219cc419370bba55af0911
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/run.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c97bcd39e938a40478a57bc9169e64a1
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/slash.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fde296a1432e3dd43a25fa7190cb6c85
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/.idea/.idea.SpriteSheetRenderer_Templated/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO].meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b0959e6f806d613428e9e90d4abbe93f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/SpawnSpritesTest.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f0163235ab75bfe4d9171377004e3600
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO].meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 29f7ff5958efee244bfa104ade03bae2
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO].meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19ad942eb2423416ca794f5aa4ba94c7
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleSpawnSprite[DEMO].meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 681b42be2da5d42a3894e9e6255ef7b1
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleSpawnSprite[DEMO]/SingleSpawner.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 14f9e071079b141878477b0e386fc360
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SpriteSheetRendererExamples.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: afd514b68eab93b47ab4de1a0d417e37
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5f2bf60bccce4c4b8b42e1d7b525951
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Spritesheet/License.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1c5fc5ef7f38d0a459d0413d54303243
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/DynamicAnimationScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 38777c214c9f28048a82984abba9b575
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/SingleEntityDestroy.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b85578409c32047d196a84b92558bd3e
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleSpawnSprite[DEMO]/Script.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2840948202e1041b1b1ff6825b32c317
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/jump_bk.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 43134456e21a9ab46b2505ee5d699f00
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 11400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/square.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5301783caef01f248a02cb3c57ed9a44
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 11400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Spritesheet.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d68a67709c220a244a3456b920cc3323
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d68d4e8798b38f6479eadda91cd18931
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 23528bb850b7540058427575eb325491
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/CharacterAnimator.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 73d6b11c1dc3f224cac3f9d9b984bdf7
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/ProjectSettings/VersionControlSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!890905787 &1
4 | VersionControlSettings:
5 | m_ObjectHideFlags: 0
6 | m_Mode: Visible Meta Files
7 | m_CollabEditorSettings:
8 | inProgressEnabled: 1
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Material/SpriteSheetMaterial.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 25e551e04c3b544338396991b11192f0
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/DynamicAnimationScene.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1d126887fd6a14f699fbf1b64d886325
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/DynamicAnimationScene/New Sub Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 70b58b3dcb4394a6ab431d7035521d99
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/Atlas.spriteatlas.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 508cf7d1943214c8daeac65d58db4619
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 4343727234628468602
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/.idea/.idea.Package-Template/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/.idea.SpriteSheetRenderer_Templated/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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.02
7 | Maximum Allowed Timestep: 0.33333334
8 | m_TimeScale: 1
9 | Maximum Particle Timestep: 0.03
10 |
--------------------------------------------------------------------------------
/Assets/Runtime/Material/SpriteSheet.shader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0ed81ae0394d38648af7d38739801948
3 | ShaderImporter:
4 | externalObjects: {}
5 | defaultTextures: []
6 | nonModifiableTextures: []
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/.idea/.idea.Package-Template/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /.idea.Package-Template.iml
6 | /modules.xml
7 | /contentModel.xml
8 | /projectSettingsUpdater.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/SpawnSpritesTestSettings.lighting.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c9c8856f4b9e9de438dc05c2de5cdd25
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 4890085278179872738
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Runtime/LICENSE.txt:
--------------------------------------------------------------------------------
1 | SpriteSheetRenderer (c) by Fabrizio Spadaro
2 |
3 | SpriteSheetRenderer is licensed under a
4 | Creative Commons Attribution 4.0 International License.
5 |
6 | You should have received a copy of the license along with this
7 | work. If not, see .
--------------------------------------------------------------------------------
/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: 0
9 | path:
10 | guid: 00000000000000000000000000000000
11 | m_configObjects: {}
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/SerializableNullable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils
4 | {
5 | [Serializable]
6 | public struct SerializableNullable
7 | where T : unmanaged
8 | {
9 | public T Value;
10 | public bool HasValue;
11 | }
12 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/CameraZoom.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cac34ef4900c544dab5c1a5e6d90b075
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/MY_PACKAGE_SCRIPT.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7a66956069554f0b84adac3ccfa91c4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/CameraController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2fee68de137cfc54f9b98a1ee089537d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/SpriteSheetCache.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e4cd65ac89fa04990919d195605c5b54
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/SpriteSheetRendererInit.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2b95e6f6a0a6f4cc9b0fe9bb18afaa99
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/CollectionUtils.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f1f2a3de235a2484b820b71bb112af3d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/EntitySpawner.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d96a27de718a44ac18f4d78d8721df72
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/SingletonBase.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 71ddc0ae4ad57455aae152a40a6269cf
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderInformation.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f0892ed38f3a540a788424d1e2fcc50c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render/MeshExtension.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0b4d52c0e822245408e2cbd49291bc25
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render/ShaderDebug.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0fd8a3f30e235ec4a97aca6eb04d9d10
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/SerializableNullable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cafaf92fb7ae44e628e6b5f4d1555978
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/Float2V.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 68bc7ebb4293a4ed9a4a30b701c67bba
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/Float3V.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 296017c3d4a8548a6bfa39d21bd10870
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/RenderGroup.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cf6d9af3eacb24b71a2884a933abc8d2
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/SpriteSheetRenderSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b71a8bdc3eba244618e4cc1743bd492c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render/ShaderDebugBuffer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: af06fc3d349bebc4d98f4c5f46aa3dfd
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/EcsSystemUtils.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 62902939e2f62414383a209270ff2eaa
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/Entity3DFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2172fe609d9b24b7286aaaac36e4c963
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/EntityDefinition.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1635694dff314abc85476527da60a7a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/SpriteSheetAnimationSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 90d41ed6b57d34380bcbd05cf07aa458
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/ColorBufferSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 302c6cd0ece0f4684a0751aaae30ee8e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/MatrixBufferSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9116a1a31470f4c718e412691e680e9c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/SpriteSheetUvSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cb0a5a33af27144009f4d2782b4020dc
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject/SpriteSheetAnimator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4c29e904357a77942b5b66944893cf95
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/ComponentReference.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3c5da6eeb52e74517a3f940c53addc07
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/DotsDebugUtils.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b05a0efca4ee40ab8a322150bf6b3b9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/GUIHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8c028240ad4f8ca4086a21f0ec734fbf
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts/LifeTime.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8033fdf1da455431599a45899baf5a82
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/DotsCollectionUtils.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ea4ada9f4942949799ecae0ecad087a8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/SpriteMovement.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 42e6d744e4a20d3419e87fa7d047cd61
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject/SpriteSheetAnimationScriptable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d000e9c4364d3764c89516aaf73c46ea
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/DotsCollectionsToString.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de5a63ccdac354589a2da9bc75263e45
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Scripts/MakeSpriteEntities.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c87523ccd27b5014a8ecc87d4d3692a5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/EntityManagerNameExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 26f61037745294b58a7ad858f7c970f2
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/Float2V.cs:
--------------------------------------------------------------------------------
1 | using Unity.Mathematics;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs
4 | {
5 | public static class Float2V
6 | {
7 | public static float2 One => new(1, 1);
8 | public static float2 BasisX => new(1, 0);
9 | public static float2 BasisY => new(0, 1);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/DynamicAnimationsDemoInit.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 87e366aeffc737d4091a5eecdad7927e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts/SingleEntityDestroy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cc452653062894b1fa8c16fba3639107
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts/SpriteManagerSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1396fdd92cdee446abada389b64b2dda
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleSpawnSprite[DEMO]/Script/SingleSpriteSheetSpawner.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 763c6c38ab1af41cf982f59635701b00
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/Components/SpriteSheetAnimationChangeCommand.cs:
--------------------------------------------------------------------------------
1 | using Unity.Entities;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Animation.Components
4 | {
5 | public struct AnimationChangeCommandBufferElement : IBufferElementData
6 | {
7 | public Entity Target;
8 | public Entity RenderGroupToSet;
9 | public bool KeepProgress;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ProjectSettings/VFXManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!937362698 &1
4 | VFXManager:
5 | m_ObjectHideFlags: 0
6 | m_IndirectShader: {fileID: 0}
7 | m_CopyBufferShader: {fileID: 0}
8 | m_SortShader: {fileID: 0}
9 | m_StripUpdateShader: {fileID: 0}
10 | m_RenderPipeSettingsPath:
11 | m_FixedTimeStep: 0.016666668
12 | m_MaxDeltaTime: 0.05
13 |
--------------------------------------------------------------------------------
/.idea/.idea.SpriteSheetRenderer_Templated/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /contentModel.xml
6 | /.idea.SpriteSheetRenderer_Templated.iml
7 | /modules.xml
8 | /projectSettingsUpdater.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/GUIHelper.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace SpriteSheetRendererExamples
4 | {
5 | public class GUIHelper : MonoBehaviour
6 | {
7 | public void ChangeAnimation(string animationName)
8 | {
9 | }
10 |
11 | // SpriteSheetAnimationSystem.SetAnimation(DynamicAnimationsDemoInit.character, animationName);
12 | }
13 | }
--------------------------------------------------------------------------------
/Assets/Runtime/MY_PACKAGE_SCRIPT.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class MY_PACKAGE_SCRIPT : MonoBehaviour
6 | {
7 | // Start is called before the first frame update
8 | void Start()
9 | {
10 |
11 | }
12 |
13 | // Update is called once per frame
14 | void Update()
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/Float3V.cs:
--------------------------------------------------------------------------------
1 | using Unity.Mathematics;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs
4 | {
5 | public static class Float3V
6 | {
7 | public static float3 One => new(1, 1, 1);
8 |
9 | public static float3 BasisX => new(1, 0, 0);
10 | public static float3 BasisY => new(0, 1, 0);
11 | public static float3 BasisZ => new(0, 0, 1);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Assembly-CSharp.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/Packages/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "com.unity.entities": "1.0.0-pre.15",
4 | "com.unity.ide.rider": "3.0.16",
5 | "com.unity.ide.visualstudio": "2.0.16",
6 | "com.unity.ide.vscode": "1.2.5",
7 | "com.unity.nuget.newtonsoft-json": "3.0.2",
8 | "com.unity.test-framework": "1.1.33",
9 | "com.unity.ugui": "1.0.0",
10 | "com.unity.modules.audio": "1.0.0",
11 | "com.unity.modules.uielements": "1.0.0"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/SpriteSheetRendererExamples.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/CameraZoom.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace SpriteSheetRendererExamples
4 | {
5 | public class CameraZoom : MonoBehaviour {
6 | float maxFov = 90f;
7 | float minFov = 20;
8 |
9 | private void Start() {
10 | minFov = 0.000000001f;
11 | }
12 |
13 | void Update() {
14 | var fov = Camera.main.orthographicSize;
15 | fov += Input.GetAxis("Mouse ScrollWheel") * fov;
16 | fov = Mathf.Clamp(fov, minFov, maxFov);
17 | Camera.main.orthographicSize = fov;
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/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 | serializedVersion: 2
7 | m_Volume: 1
8 | Rolloff Scale: 1
9 | Doppler Factor: 1
10 | Default Speaker Mode: 2
11 | m_SampleRate: 0
12 | m_DSPBufferSize: 1024
13 | m_VirtualVoiceCount: 512
14 | m_RealVoiceCount: 32
15 | m_SpatializerPlugin:
16 | m_AmbisonicDecoderPlugin:
17 | m_DisableAudio: 0
18 | m_VirtualizeEffects: 1
19 | m_RequestedDSPBufferSize: 0
20 |
--------------------------------------------------------------------------------
/ProjectSettings/EntitiesClientSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: e2ea235c1fcfe29488ed97c467a0da53, type: 3}
13 | m_Name:
14 | m_EditorClassIdentifier:
15 | FilterSettings:
16 | ExcludedBakingSystemAssemblies: []
17 |
--------------------------------------------------------------------------------
/SpriteSheetRenderer.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/CharacterAnimator.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: 4c29e904357a77942b5b66944893cf95, type: 3}
13 | m_Name: CharacterAnimator
14 | m_EditorClassIdentifier:
15 | animations:
16 | - {fileID: 11400000, guid: c97bcd39e938a40478a57bc9169e64a1, type: 2}
17 | defaultAnimationIndex: 0
18 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/EntityDefinition.cs:
--------------------------------------------------------------------------------
1 | using Unity.Entities;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs
4 | {
5 | public struct EntityDefinition
6 | {
7 | public readonly ComponentType[] ComponentTypes;
8 | public readonly EntityArchetype Archetype;
9 |
10 | public EntityDefinition(ComponentType[] componentTypes)
11 | {
12 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
13 | ComponentTypes = componentTypes;
14 | Archetype = eManager.CreateArchetype(componentTypes);
15 | }
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject/StaticSpriteScriptable.cs:
--------------------------------------------------------------------------------
1 | using Unity.Entities;
2 | using UnityEngine;
3 |
4 | namespace SmokGnu.SpriteSheetRenderer.ScriptableObject
5 | {
6 | [System.Serializable]
7 | [CreateAssetMenu(fileName = "StaticSprite", menuName = "SpriteSheetRenderer/StaticSprite", order = 0)]
8 | public class StaticSpriteScriptable : UnityEngine.ScriptableObject
9 | {
10 | public Sprite Sprite;
11 | public Entity RenderGroup { get; private set; }
12 |
13 | public void Init(Entity renderGroup)
14 | {
15 | RenderGroup = renderGroup;
16 | }
17 | }
18 | }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/SpriteSheetRenderer.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SpriteSheetRenderer",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:734d92eba21c94caba915361bd5ac177",
6 | "GUID:2665a8d13d1b3f18800f46e256720795",
7 | "GUID:d8b63aba1907145bea998dd612889d6b",
8 | "GUID:a5baed0c9693541a5bd947d336ec7659",
9 | "GUID:e0cd26848372d4e5c891c569017e11f1"
10 | ],
11 | "includePlatforms": [],
12 | "excludePlatforms": [],
13 | "allowUnsafeCode": true,
14 | "overrideReferences": false,
15 | "precompiledReferences": [],
16 | "autoReferenced": true,
17 | "defineConstraints": [],
18 | "versionDefines": [],
19 | "noEngineReferences": false
20 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Spritesheet/License.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1-Bit Pack
4 |
5 | Created/distributed by Kenney (www.kenney.nl)
6 | Creation date: 06-05-2019
7 |
8 | ------------------------------
9 |
10 | License: (Creative Commons Zero, CC0)
11 | http://creativecommons.org/publicdomain/zero/1.0/
12 |
13 | This content is free to use in personal, educational and commercial projects.
14 |
15 | Support us by crediting Kenney or www.kenney.nl (this is not mandatory)
16 |
17 | ------------------------------
18 |
19 | Donate: http://support.kenney.nl
20 | Request: http://request.kenney.nl
21 | Patreon: http://patreon.com/kenney/
22 |
23 | Follow on Twitter for updates:
24 | http://twitter.com/KenneyNL
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts/SpriteManagerSystem.cs:
--------------------------------------------------------------------------------
1 | namespace SpriteSheetRendererExamples
2 | {
3 | // public class SpriteManagerSystem : ComponentSystem
4 | // {
5 | // protected override void OnUpdate()
6 | // {
7 | // Entities.WithAll().ForEach((Entity entity, ref LifeTime lifetime) =>
8 | // {
9 | // if (lifetime.Value < 0)
10 | // {
11 | // // SpriteSheetManager.Instance.DestroyEntity(entity, "emoji");
12 | // }
13 | // else
14 | // {
15 | // lifetime.Value -= Time.DeltaTime;
16 | // }
17 | // });
18 | // }
19 | // }
20 | }
--------------------------------------------------------------------------------
/Assets/Runtime/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.taras_martyniuk.sprite_sheet_renderer",
3 | "version": "0.115.0",
4 | "displayName": "SpriteSheetRenderer",
5 | "description": "A powerful Unity ECS system to render massive numbers of animated sprites.",
6 | "unity": "2020.2",
7 | "dependencies": {
8 | "com.unity.entities": "0.17.0-preview.42",
9 | "com.unity.burst": "1.5.4",
10 | "com.unity.2d.sprite": "1.0.0",
11 | "com.unity.2d.tilemap": "1.0.0",
12 | "com.unity.textmeshpro": "3.0.1",
13 | "com.unity.mathematics": "1.2.1"
14 | },
15 | "keywords": [
16 | "sprite",
17 | "2D",
18 | "ECS"
19 | ],
20 | "author": {
21 | "name": "Fabrizio Spadaro, Victor Pan",
22 | "url": "https://github.com/LordArugula/SpriteSheetRenderer"
23 | }
24 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/MatrixBufferSystem.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Animation.Components;
2 | using SmokGnu.SpriteSheetRenderer.Render.RenderGroup.Components;
3 | using Unity.Entities;
4 | using Unity.Transforms;
5 |
6 | namespace SmokGnu.SpriteSheetRenderer.Render.RenderGroup
7 | {
8 | public partial class MatrixBufferSystem : SystemBase
9 | {
10 | protected override void OnUpdate()
11 | {
12 |
13 | Entities.ForEach((in SpriteSheetRenderGroupHookComponent hook, in LocalToWorld localToWorld) =>
14 | {
15 | var buffer = GetBuffer(hook.SpritesheetRenderGroup);
16 | buffer[hook.IndexInRenderGroup] = localToWorld.Value;
17 | })
18 | .Schedule();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 437f9cdc5793e454fbbab25d7308ffaf
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/hit.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: d000e9c4364d3764c89516aaf73c46ea, type: 3}
13 | m_Name: hit
14 | m_EditorClassIdentifier:
15 | animationName: hit
16 | sprites:
17 | - {fileID: -417436994572597314, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
18 | - {fileID: -7232779301871914677, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
19 | - {fileID: -417436994572597314, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
20 | startIndex: 0
21 | playOnStart: 1
22 | samples: 32
23 | repetition: 0
24 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/SpriteSheetUvSystem.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Animation.Components;
2 | using SmokGnu.SpriteSheetRenderer.Render.RenderGroup.Components;
3 | using Unity.Entities;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.Render.RenderGroup
6 | {
7 | public partial class SpriteSheetUvJobSystem : SystemBase
8 | {
9 | protected override void OnUpdate()
10 | {
11 | Entities.ForEach((in SpriteSheetRenderGroupHookComponent hook, in SpriteIndex data) =>
12 | {
13 | var buffer = GetBuffer(hook.SpritesheetRenderGroup);
14 | buffer[hook.IndexInRenderGroup] = data.Value;
15 | })
16 | // .WithChangeFilter()
17 | // .Schedule();
18 | .WithoutBurst()
19 | .Run();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/jump.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: d000e9c4364d3764c89516aaf73c46ea, type: 3}
13 | m_Name: jump
14 | m_EditorClassIdentifier:
15 | animationName: jump
16 | sprites:
17 | - {fileID: -654221344278647648, guid: a1ffe2230b9de4eb98a84c30452fa8d5, type: 3}
18 | - {fileID: 6191509826233423226, guid: a1ffe2230b9de4eb98a84c30452fa8d5, type: 3}
19 | - {fileID: -3382597266031040065, guid: a1ffe2230b9de4eb98a84c30452fa8d5, type: 3}
20 | - {fileID: -532575279437139693, guid: a1ffe2230b9de4eb98a84c30452fa8d5, type: 3}
21 | startIndex: 0
22 | playOnStart: 1
23 | samples: 64
24 | repetition: 1
25 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SpriteSheetRendererExamples.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SpriteSheetRendererExamples",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:734d92eba21c94caba915361bd5ac177",
6 | "GUID:2665a8d13d1b3f18800f46e256720795",
7 | "GUID:d8b63aba1907145bea998dd612889d6b",
8 | "GUID:a5baed0c9693541a5bd947d336ec7659",
9 | "GUID:6a7691b896cc8ad4ca5aa9883d9c4e19",
10 | "GUID:8819f35a0fc84499b990e90a4ca1911f",
11 | "GUID:44dcb2bf5b9be4b5aa76674c8edcd1d5",
12 | "GUID:1c4ccdefa6e8cf04cbb2278f1c5d78b7",
13 | "GUID:e0cd26848372d4e5c891c569017e11f1"
14 | ],
15 | "includePlatforms": [],
16 | "excludePlatforms": [],
17 | "allowUnsafeCode": false,
18 | "overrideReferences": false,
19 | "precompiledReferences": [],
20 | "autoReferenced": true,
21 | "defineConstraints": [],
22 | "versionDefines": [],
23 | "noEngineReferences": false
24 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/slash.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: d000e9c4364d3764c89516aaf73c46ea, type: 3}
13 | m_Name: slash
14 | m_EditorClassIdentifier:
15 | animationName: slash
16 | sprites:
17 | - {fileID: -3102994270238535240, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
18 | - {fileID: 7729768860333772239, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
19 | - {fileID: -3102994270238535240, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
20 | - {fileID: -4572274602858593414, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
21 | startIndex: 0
22 | playOnStart: 1
23 | samples: 32
24 | repetition: 0
25 |
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/jump_bk.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: d000e9c4364d3764c89516aaf73c46ea, type: 3}
13 | m_Name: jump_bk
14 | m_EditorClassIdentifier:
15 | animationName: jump
16 | sprites:
17 | - {fileID: -4256427906160430202, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
18 | - {fileID: -6066236442320969475, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
19 | - {fileID: 1893670189769602202, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
20 | - {fileID: -5691007311618604778, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
21 | startIndex: 0
22 | playOnStart: 1
23 | samples: 64
24 | repetition: 1
25 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/SpriteSheetAnimationDeferredChangeSystem.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Animation.Components;
2 | using Unity.Entities;
3 |
4 | namespace SmokGnu.SpriteSheetRenderer.Animation
5 | {
6 | [DisableAutoCreation]
7 | public partial class SpriteSheetAnimationDeferredChangeSystem : SystemBase
8 | {
9 | protected override void OnUpdate()
10 | {
11 | var commands = this.GetSingletonBuffer();
12 |
13 | foreach (var command in commands)
14 | {
15 | SpriteSheetAnimationSystem.SetAnimation(command.Target, command.RenderGroupToSet, command.KeepProgress);
16 | // DebugExtensions.LogVar(new { tgt = command.Target.Stringify(), anim = command.RenderGroupToSet.Stringify() }, "Deferred Anim change: ",
17 | // addCurrFrame: true);
18 | }
19 |
20 | commands.Clear();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject/SpriteSheetAnimator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Unity.Entities;
3 | using UnityEngine;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.ScriptableObject
6 | {
7 | [CreateAssetMenu(fileName = "SpriteSheetAnimator", menuName = "SpriteSheetRenderer/SpriteSheetAnimator", order = 0)]
8 | public class SpriteSheetAnimator : UnityEngine.ScriptableObject
9 | {
10 | public SpriteSheetAnimationScriptable[] animations;
11 | public int defaultAnimationIndex;
12 |
13 | public SpriteSheetAnimationScriptable GetAnimation(Entity renderGroup) =>
14 | Array.Find(animations, a => a.RenderGroup == renderGroup);
15 |
16 | public int GetAnimationIndex(string animationName)
17 | {
18 | for (var i = 0; i < animations.Length; i++)
19 | {
20 | if (animations[i].name == animationName)
21 | return i;
22 | }
23 |
24 | return -1;
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/SpriteSheetRendererInit.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Animation;
2 | using SmokGnu.SpriteSheetRenderer.Animation.Components;
3 | using SmokGnu.SpriteSheetRenderer.Render;
4 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs;
5 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS;
6 | using Unity.Entities;
7 | using UnityEngine;
8 |
9 | namespace SmokGnu.SpriteSheetRenderer
10 | {
11 | public static class SpriteSheetRendererInit
12 | {
13 | public static void Init(Shader spriteSheetShader)
14 | {
15 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
16 | eManager.CreateEntity("SpriteSheetAnimationSingleton", typeof(AnimationChangeCommandBufferElement));
17 | EcsSystemUtils.CreateSystemManaged().Init(spriteSheetShader);
18 | EcsSystemUtils.CreateSimulationSystemManaged();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/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 | serializedVersion: 1
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com
12 | m_TestInitMode: 0
13 | CrashReportingSettings:
14 | m_EventUrl: https://perf-events.cloud.unity3d.com
15 | m_Enabled: 0
16 | m_LogBufferSize: 10
17 | m_CaptureEditorExceptions: 1
18 | UnityPurchasingSettings:
19 | m_Enabled: 0
20 | m_TestMode: 0
21 | UnityAnalyticsSettings:
22 | m_Enabled: 0
23 | m_TestMode: 0
24 | m_InitializeOnStartup: 1
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 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/SingletonBase.cs:
--------------------------------------------------------------------------------
1 | namespace SmokGnu.SpriteSheetRenderer.Utils
2 | {
3 | public class SingletonBase where T
4 | : class, new()
5 | {
6 | public static T Instance
7 | {
8 | get
9 | {
10 | if (m_instance == null)
11 | {
12 | m_instance = new T();
13 | }
14 | return m_instance;
15 |
16 | }
17 | private set => m_instance = value;
18 | }
19 |
20 | private static T m_instance;
21 | }
22 |
23 | public class SingletonInterfaceBase
24 | where TInterface : class
25 | where TConcrete : TInterface, new()
26 | {
27 | public static TInterface Instance
28 | {
29 | get
30 | {
31 | if (m_instance == null)
32 | {
33 | m_instance = new TConcrete();
34 | }
35 | return m_instance;
36 |
37 | }
38 | private set => m_instance = value;
39 | }
40 |
41 | private static TInterface m_instance;
42 | }
43 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/DotsCollectionsToString.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using Unity.Collections;
3 | using Unity.Entities;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS
6 | {
7 | public static class DotsCollectionsToString
8 | {
9 | public static string Stringify(this Entity e)
10 | {
11 | return World.DefaultGameObjectInjectionWorld.EntityManager.GetName(e);
12 | }
13 |
14 | public static string Stringify(this NativeArray array)
15 | where T : unmanaged
16 | {
17 | var sb = new StringBuilder('[');
18 | foreach (var item in array)
19 | {
20 | sb.Append(item);
21 | sb.Append(", ");
22 | }
23 | sb.Append(']');
24 | return sb.ToString();
25 | }
26 |
27 | public static string Stringify(this DynamicBuffer buff)
28 | where T : unmanaged
29 | => Stringify(buff.AsNativeArray());
30 |
31 | public static string Stringify(this NativeList list)
32 | where T : unmanaged
33 | => Stringify(list.AsArray());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ProjectSettings/PackageManagerSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
13 | m_Name:
14 | m_EditorClassIdentifier:
15 | m_EnablePreviewPackages: 0
16 | m_EnablePackageDependencies: 0
17 | m_AdvancedSettingsExpanded: 1
18 | m_ScopedRegistriesSettingsExpanded: 1
19 | oneTimeWarningShown: 0
20 | m_Registries:
21 | - m_Id: main
22 | m_Name:
23 | m_Url: https://packages.unity.com
24 | m_Scopes: []
25 | m_IsDefault: 1
26 | m_Capabilities: 7
27 | m_UserSelectedRegistryName:
28 | m_UserAddingNewScopedRegistry: 0
29 | m_RegistryInfoDraft:
30 | m_ErrorMessage:
31 | m_Original:
32 | m_Id:
33 | m_Name:
34 | m_Url:
35 | m_Scopes: []
36 | m_IsDefault: 0
37 | m_Capabilities: 0
38 | m_Modified: 0
39 | m_Name:
40 | m_Url:
41 | m_Scopes:
42 | -
43 | m_SelectedScopeIndex: 0
44 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render/ShaderDebugBuffer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Unity.Collections.LowLevel.Unsafe;
3 | using UnityEngine;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.Utils.Render
6 | {
7 | public class ShaderDebugBuffer : IDisposable
8 | where T : struct
9 | {
10 | public ComputeBuffer ComputeBuffer { get; private set; }
11 | public T[] m_debugBufferRetrieved { get; private set; }
12 |
13 | public Material Material { get; set; }
14 |
15 | public ShaderDebugBuffer(int size)
16 | {
17 | var stride = UnsafeUtility.SizeOf();
18 |
19 | ComputeBuffer = new ComputeBuffer(size, stride, ComputeBufferType.Default);
20 | m_debugBufferRetrieved = new T[size];
21 | }
22 |
23 | public void Dispose() => ComputeBuffer.Release();
24 |
25 | public T[] GetBufferData()
26 | {
27 | Graphics.ClearRandomWriteTargets();
28 | Material.SetBuffer("_DebugBuffer", ComputeBuffer);
29 | Graphics.SetRandomWriteTarget(1, ComputeBuffer, false);
30 | ComputeBuffer.GetData(m_debugBufferRetrieved);
31 | return m_debugBufferRetrieved;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/ColorBufferSystem.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Animation.Components;
2 | using SmokGnu.SpriteSheetRenderer.Render.RenderGroup.Components;
3 | using Unity.Collections;
4 | using Unity.Entities;
5 |
6 | namespace SmokGnu.SpriteSheetRenderer.Render.RenderGroup
7 | {
8 | public partial class ColorBufferSystem : SystemBase
9 | {
10 | protected override void OnUpdate()
11 | {
12 | Entities.ForEach((Entity e, in SpriteSheetRenderGroupHookComponent hook, in SpriteSheetColor data) =>
13 | {
14 | var buffer = GetBuffer(hook.SpritesheetRenderGroup);
15 | buffer[hook.IndexInRenderGroup] = data.Value;
16 | })
17 | //.WithChangeFilter()
18 | .WithoutBurst()
19 | .Run();
20 | // .Schedule();
21 | }
22 | }
23 |
24 | public static class JobSystemUtils
25 | {
26 | public static NativeArray SingleElementInputArray(T element, Allocator allocator = Allocator.TempJob) where T : struct
27 | {
28 | var result = new NativeArray(1, allocator);
29 | result[0] = element;
30 | return result;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/ComponentReference.cs:
--------------------------------------------------------------------------------
1 | using Unity.Collections.LowLevel.Unsafe;
2 | using Unity.Entities;
3 |
4 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs
5 | {
6 | public ref struct ComponentReference where T : unmanaged, IComponentData
7 | {
8 | T m_component;
9 | Entity m_entity;
10 |
11 | public ComponentReference(Entity entity)
12 | {
13 | m_entity = entity;
14 | m_component = default;
15 | ReadComponent();
16 | }
17 |
18 | public ref T Value()
19 | {
20 | unsafe
21 | {
22 | return ref UnsafeUtility.AsRef(UnsafeUtility.AddressOf(ref m_component));
23 | }
24 | }
25 |
26 | public void ReadComponent()
27 | {
28 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
29 | m_component = eManager.GetComponentData(m_entity);
30 | }
31 |
32 | public void WriteComponent()
33 | {
34 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
35 | eManager.SetComponentData(m_entity, m_component);
36 | }
37 |
38 | public void Dispose()
39 | {
40 | WriteComponent();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Animation/Components/SpriteSheetAnimationComponents.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS;
2 | using Unity.Entities;
3 | using Unity.Mathematics;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.Animation.Components
6 | {
7 | public struct SpriteIndex : IComponentData
8 | {
9 | public int Value;
10 | }
11 |
12 | public struct SpriteSheetColor : IComponentData
13 | {
14 | public float4 Value;
15 | }
16 |
17 | public struct SpriteSheetRenderGroupHookComponent : IComponentData
18 | {
19 | public int IndexInRenderGroup;
20 | public Entity SpritesheetRenderGroup;
21 |
22 | public override string ToString() => $"I: {IndexInRenderGroup}, Group: {SpritesheetRenderGroup.Stringify()}";
23 | }
24 |
25 | public struct SpriteSheetAnimationComponent : IComponentData
26 | {
27 | public Entity CurrentAnimation;
28 | public float FrameStartTime;
29 |
30 | public ESpriteSheetAnimationStatus Status;
31 |
32 | // true for the first frame when the animation event sprite(keyframe) is rendered
33 | public bool IsAnimationEventTriggeredThisFrame;
34 | }
35 |
36 | public enum ESpriteSheetAnimationStatus
37 | {
38 | Invalid,
39 | Playing,
40 | Paused,
41 | Ended
42 | }
43 | }
--------------------------------------------------------------------------------
/ProjectSettings/MemorySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!387306366 &1
4 | MemorySettings:
5 | m_ObjectHideFlags: 0
6 | m_EditorMemorySettings:
7 | m_MainAllocatorBlockSize: -1
8 | m_ThreadAllocatorBlockSize: -1
9 | m_MainGfxBlockSize: -1
10 | m_ThreadGfxBlockSize: -1
11 | m_CacheBlockSize: -1
12 | m_TypetreeBlockSize: -1
13 | m_ProfilerBlockSize: -1
14 | m_ProfilerEditorBlockSize: -1
15 | m_BucketAllocatorGranularity: -1
16 | m_BucketAllocatorBucketsCount: -1
17 | m_BucketAllocatorBlockSize: -1
18 | m_BucketAllocatorBlockCount: -1
19 | m_ProfilerBucketAllocatorGranularity: -1
20 | m_ProfilerBucketAllocatorBucketsCount: -1
21 | m_ProfilerBucketAllocatorBlockSize: -1
22 | m_ProfilerBucketAllocatorBlockCount: -1
23 | m_TempAllocatorSizeMain: -1
24 | m_JobTempAllocatorBlockSize: -1
25 | m_BackgroundJobTempAllocatorBlockSize: -1
26 | m_JobTempAllocatorReducedBlockSize: -1
27 | m_TempAllocatorSizeGIBakingWorker: -1
28 | m_TempAllocatorSizeNavMeshWorker: -1
29 | m_TempAllocatorSizeAudioWorker: -1
30 | m_TempAllocatorSizeCloudWorker: -1
31 | m_TempAllocatorSizeGfx: -1
32 | m_TempAllocatorSizeJobWorker: -1
33 | m_TempAllocatorSizeBackgroundWorker: -1
34 | m_TempAllocatorSizePreloadManager: -1
35 | m_PlatformMemorySettings: {}
36 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/Scripts/MakeSpriteEntities.cs:
--------------------------------------------------------------------------------
1 | // using System;
2 | // using System.Collections.Generic;
3 | // using Unity.Collections;
4 | // using Unity.Entities;
5 | // using Unity.Mathematics;
6 | // using Unity.Transforms;
7 | // using UnityEngine;
8 | // using Random = Unity.Mathematics.Random;
9 | // namespace SpriteSheetRendererExamples
10 | // {
11 | //
12 | // public class MakeSpriteEntities : MonoBehaviour, IConvertGameObjectToEntity
13 | // {
14 | // public float2 spawnArea = new float2(100, 100);
15 | // public int spriteCount = 5000;
16 | // public Sprite[] sprites;
17 | //
18 | // public void Convert(Entity entity, EntityManager eManager, GameObjectConversionSystem conversionSystem)
19 | // {
20 | // throw new NotImplementedException();
21 | //
22 | // }
23 | //
24 | // private void OnDrawGizmosSelected()
25 | // {
26 | // var r = GetSpawnArea();
27 | // Gizmos.color = new Color(0, .35f, .45f, .24f);
28 | // Gizmos.DrawCube(r.center, r.size);
29 | // }
30 | //
31 | // Rect GetSpawnArea()
32 | // {
33 | // Rect r = new Rect(0, 0, spawnArea.x, spawnArea.y);
34 | // r.center = transform.position;
35 | // return r;
36 | // }
37 | // }
38 | // }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render/MeshExtension.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils.Render
4 | {
5 | public abstract class MeshExtension {
6 | public static Mesh Quad() {
7 | var mesh = new Mesh();
8 | var vertices = new Vector3[4];
9 | vertices[0] = new Vector3(0, 0, 0);
10 | vertices[1] = new Vector3(1, 0, 0);
11 | vertices[2] = new Vector3(0, 1, 0);
12 | vertices[3] = new Vector3(1, 1, 0);
13 | mesh.vertices = vertices;
14 |
15 | var tri = new int[6];
16 | tri[0] = 0;
17 | tri[1] = 2;
18 | tri[2] = 1;
19 | tri[3] = 2;
20 | tri[4] = 3;
21 | tri[5] = 1;
22 | mesh.triangles = tri;
23 |
24 | var normals = new Vector3[4];
25 | normals[0] = -Vector3.forward;
26 | normals[1] = -Vector3.forward;
27 | normals[2] = -Vector3.forward;
28 | normals[3] = -Vector3.forward;
29 | mesh.normals = normals;
30 |
31 | var uv = new Vector2[4];
32 | uv[0] = new Vector2(0, 0);
33 | uv[1] = new Vector2(1, 0);
34 | uv[2] = new Vector2(0, 1);
35 | uv[3] = new Vector2(1, 1);
36 | mesh.uv = uv;
37 |
38 | return mesh;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/EntitySpawner.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils
4 | {
5 | public class EntitySpawner : MonoBehaviour {
6 | //QuadTree qt = null;
7 | //private Text spriteCount;
8 | //private void Start() {
9 | // qt = Fractalnitializer.qt;
10 | // spriteCount = GameObject.Find("EntityCount").GetComponent();
11 | //}
12 |
13 | //public void Update() {
14 | // if(Input.GetMouseButton(0)) {
15 | // var screenPoint = Input.mousePosition;
16 | // screenPoint.z = 10.0f; //distance of the plane from the camera
17 | // screenPoint = Camera.main.ScreenToWorldPoint(screenPoint);
18 | // qt.Insert(new float2(screenPoint.x, screenPoint.y));
19 | // }
20 | // if(Input.GetMouseButtonDown(1)) {
21 | // var screenPoint = Input.mousePosition;
22 | // screenPoint.z = 10.0f; //distance of the plane from the camera
23 | // screenPoint = Camera.main.ScreenToWorldPoint(screenPoint);
24 | // qt.Insert(new float2(screenPoint.x, screenPoint.y));
25 | // }
26 | // spriteCount.text = "Entity Count: " + (World.DefaultGameObjectInjectionWorld.EntityManager.Debug.EntityCount - 2).ToString();
27 | //}
28 | //public void Subdivide() {
29 | // qt.Insert(float2.zero, true);
30 | //}
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/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: 13
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.1
18 | m_ClothInterCollisionStiffness: 0.2
19 | m_ContactsGeneration: 1
20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21 | m_AutoSimulation: 1
22 | m_AutoSyncTransforms: 0
23 | m_ReuseCollisionCallbacks: 1
24 | m_ClothInterCollisionSettingsToggle: 0
25 | m_ClothGravity: {x: 0, y: -9.81, z: 0}
26 | m_ContactPairsMode: 0
27 | m_BroadphaseType: 0
28 | m_WorldBounds:
29 | m_Center: {x: 0, y: 0, z: 0}
30 | m_Extent: {x: 250, y: 250, z: 250}
31 | m_WorldSubdivisions: 8
32 | m_FrictionType: 0
33 | m_EnableEnhancedDeterminism: 0
34 | m_EnableUnifiedHeightmaps: 1
35 | m_SolverType: 0
36 | m_DefaultMaxAngularSpeed: 50
37 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/EcsSystemUtils.cs:
--------------------------------------------------------------------------------
1 | using Unity.Entities;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs
4 | {
5 | public static class EcsSystemUtils
6 | {
7 | public static T CreateSimulationSystemManaged()
8 | where T : SystemBase, new()
9 | => CreateSystemManaged();
10 |
11 | public static T CreateSystemManaged()
12 | where T : SystemBase, new()
13 | where TSystemGroup : ComponentSystemGroup
14 | {
15 | var system = World.DefaultGameObjectInjectionWorld.CreateSystemManaged();
16 | AddSystemForUpdate(system);
17 | return system;
18 | }
19 |
20 | public static DynamicBuffer GetReinterprettedBuffer(this SystemBase system, Entity entity)
21 | where T : unmanaged, IBufferElementData
22 | where TReinterpret : unmanaged
23 | => system.GetBuffer(entity).Reinterpret();
24 |
25 | private static void AddSystemForUpdate(T system)
26 | where T : SystemBase
27 | where TSystemGroup : ComponentSystemGroup
28 | {
29 | var defaultWorld = World.DefaultGameObjectInjectionWorld;
30 | var systemGroup = defaultWorld.GetOrCreateSystemManaged();
31 | systemGroup.AddSystemToUpdateList(system);
32 | }
33 |
34 | }
35 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/square.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: d000e9c4364d3764c89516aaf73c46ea, type: 3}
13 | m_Name: square
14 | m_EditorClassIdentifier:
15 | Sprites:
16 | - {fileID: -997972493423046422, guid: 252e73463dc5649eca48720230253e81, type: 3}
17 | - {fileID: -199644854353079308, guid: 252e73463dc5649eca48720230253e81, type: 3}
18 | - {fileID: -217455086581007235, guid: 252e73463dc5649eca48720230253e81, type: 3}
19 | - {fileID: 4335250483284255847, guid: 252e73463dc5649eca48720230253e81, type: 3}
20 | - {fileID: -983156657889264743, guid: 252e73463dc5649eca48720230253e81, type: 3}
21 | - {fileID: -2850093654693141264, guid: 252e73463dc5649eca48720230253e81, type: 3}
22 | - {fileID: 9093825842685103111, guid: 252e73463dc5649eca48720230253e81, type: 3}
23 | - {fileID: 3150387745278999259, guid: 252e73463dc5649eca48720230253e81, type: 3}
24 | - {fileID: 3210994475073176143, guid: 252e73463dc5649eca48720230253e81, type: 3}
25 | SpriteSheet: {fileID: -997972493423046422, guid: 252e73463dc5649eca48720230253e81, type: 3}
26 | m_definition:
27 | Duration: 5
28 | Repetition: 0
29 | FrameDuration: 0
30 | SpriteCount: 0
31 | m_eventFrame:
32 | Value: 0
33 | HasValue: 0
34 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/ScriptableObject/SpriteSheetAnimationScriptable.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Render.RenderGroup.Components;
2 | using SmokGnu.SpriteSheetRenderer.Utils;
3 | using Unity.Entities;
4 | using UnityEngine;
5 |
6 | namespace SmokGnu.SpriteSheetRenderer.ScriptableObject
7 | {
8 | [System.Serializable]
9 | [CreateAssetMenu(fileName = "SpriteSheetAnimationData", menuName = "SpriteSheetRenderer/SpriteSheetAnimationData", order = 0)]
10 | public class SpriteSheetAnimationScriptable : UnityEngine.ScriptableObject
11 | {
12 | public Sprite[] Sprites;
13 | public Sprite SpriteSheet;
14 | public Entity RenderGroup { get; private set; }
15 |
16 | public void Init(Entity renderGroup)
17 | {
18 | Debug.Assert(m_definition.Duration != 0, $"duration == 0, {name}");
19 |
20 | if (m_eventFrame.HasValue)
21 | m_definition.EventFrame = m_eventFrame.Value;
22 | m_definition.SpriteCount = Sprites.Length;
23 | m_definition.FrameDuration = m_definition.Duration / Sprites.Length;
24 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
25 | eManager.SetComponentData(renderGroup, m_definition);
26 | RenderGroup = renderGroup;
27 | }
28 | // public Entity DefinitionEntity { get; private set; }
29 |
30 | [SerializeField] SpriteSheetAnimationDefinitionComponent m_definition;
31 | [SerializeField] SerializableNullable m_eventFrame;
32 | }
33 | }
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/Render/ShaderDebug.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace SmokGnu.SpriteSheetRenderer.Utils.Render
4 | {
5 | public class ShaderDebug : MonoBehaviour
6 | {
7 | public GameObject target;
8 | private ComputeBuffer buffer;
9 | private Vector4[] element;
10 | private string label;
11 |
12 | private Material material;
13 | private Renderer render;
14 |
15 | void Start ()
16 | {
17 | Load();
18 | }
19 |
20 | void Update ()
21 | {
22 | Graphics.ClearRandomWriteTargets();
23 | material.SetPass(0);
24 | material.SetBuffer("buffer", buffer);
25 | Graphics.SetRandomWriteTarget(1, buffer, false);
26 | buffer.GetData(element);
27 | label = (element != null && render.isVisible) ? element[0].ToString("F3") : string.Empty;
28 |
29 | Debug.Log(label);
30 | }
31 |
32 | //void OnGUI()
33 | //{
34 | // GUIStyle style = new GUIStyle();
35 | // style.fontSize = 32;
36 | // GUI.Label(new Rect(50, 50, 400, 100), label, style);
37 | //}
38 |
39 | void OnDestroy()
40 | {
41 | buffer.Dispose();
42 | }
43 |
44 | void Load ()
45 | {
46 | buffer = new ComputeBuffer(1, 16, ComputeBufferType.Default);
47 | element = new Vector4[1];
48 | label = string.Empty;
49 | render = target.GetComponent();
50 | material = render.material;
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Sprites/run.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: d000e9c4364d3764c89516aaf73c46ea, type: 3}
13 | m_Name: run
14 | m_EditorClassIdentifier:
15 | Sprites:
16 | - {fileID: 3083089168873209362, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
17 | - {fileID: -517894308114096243, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
18 | - {fileID: 7755224123621818408, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
19 | - {fileID: -3557554893070573299, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
20 | - {fileID: -4256427906160430202, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
21 | - {fileID: -6066236442320969475, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
22 | - {fileID: 1893670189769602202, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
23 | - {fileID: -5691007311618604778, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
24 | - {fileID: -417436994572597314, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
25 | - {fileID: -7232779301871914677, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
26 | - {fileID: 7729768860333772239, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
27 | SpriteSheet: {fileID: 3083089168873209362, guid: 57f6b6fe96601a14694379954154ba7c, type: 3}
28 | m_definition:
29 | Duration: 5
30 | Repetition: 2
31 | FrameDuration: 0
32 | SpriteCount: 0
33 | m_eventFrame:
34 | Value: 0
35 | HasValue: 0
36 |
--------------------------------------------------------------------------------
/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: 12
7 | m_SerializationMode: 2
8 | m_LineEndingsForNewScripts: 0
9 | m_DefaultBehaviorMode: 1
10 | m_PrefabRegularEnvironment: {fileID: 0}
11 | m_PrefabUIEnvironment: {fileID: 0}
12 | m_SpritePackerMode: 4
13 | m_SpritePackerCacheSize: 10
14 | m_SpritePackerPaddingPower: 1
15 | m_Bc7TextureCompressor: 0
16 | m_EtcTextureCompressorBehavior: 1
17 | m_EtcTextureFastCompressor: 1
18 | m_EtcTextureNormalCompressor: 2
19 | m_EtcTextureBestCompressor: 4
20 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp
21 | m_ProjectGenerationRootNamespace:
22 | m_EnableTextureStreamingInEditMode: 1
23 | m_EnableTextureStreamingInPlayMode: 1
24 | m_EnableEditorAsyncCPUTextureLoading: 0
25 | m_AsyncShaderCompilation: 1
26 | m_PrefabModeAllowAutoSave: 1
27 | m_EnterPlayModeOptionsEnabled: 1
28 | m_EnterPlayModeOptions: 3
29 | m_GameObjectNamingDigits: 1
30 | m_GameObjectNamingScheme: 0
31 | m_AssetNamingUsesSpace: 1
32 | m_InspectorUseIMGUIDefaultInspector: 0
33 | m_UseLegacyProbeSampleCount: 0
34 | m_SerializeInlineMappingsOnOneLine: 1
35 | m_DisableCookiesInLightmapper: 1
36 | m_AssetPipelineMode: 1
37 | m_RefreshImportMode: 0
38 | m_CacheServerMode: 0
39 | m_CacheServerEndpoint:
40 | m_CacheServerNamespacePrefix: default
41 | m_CacheServerEnableDownload: 1
42 | m_CacheServerEnableUpload: 1
43 | m_CacheServerEnableAuth: 0
44 | m_CacheServerEnableTls: 0
45 | m_CacheServerValidationMode: 2
46 | m_CacheServerDownloadBatchSize: 128
47 | m_EnableEnlightenBakedGI: 0
48 |
--------------------------------------------------------------------------------
/Assets/Runtime/Plugins/NSubstitute.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f244caf4df9944e53aa4d04952343ed4
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 1
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | : Any
16 | second:
17 | enabled: 0
18 | settings:
19 | Exclude Android: 1
20 | Exclude Editor: 0
21 | Exclude Linux64: 0
22 | Exclude OSXUniversal: 0
23 | Exclude Win: 0
24 | Exclude Win64: 0
25 | - first:
26 | Android: Android
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: ARMv7
31 | - first:
32 | Any:
33 | second:
34 | enabled: 0
35 | settings: {}
36 | - first:
37 | Editor: Editor
38 | second:
39 | enabled: 1
40 | settings:
41 | CPU: AnyCPU
42 | DefaultValueInitialized: true
43 | OS: AnyOS
44 | - first:
45 | Standalone: Linux64
46 | second:
47 | enabled: 1
48 | settings:
49 | CPU: None
50 | - first:
51 | Standalone: OSXUniversal
52 | second:
53 | enabled: 1
54 | settings:
55 | CPU: None
56 | - first:
57 | Standalone: Win
58 | second:
59 | enabled: 1
60 | settings:
61 | CPU: None
62 | - first:
63 | Standalone: Win64
64 | second:
65 | enabled: 1
66 | settings:
67 | CPU: None
68 | - first:
69 | Windows Store Apps: WindowsStoreApps
70 | second:
71 | enabled: 0
72 | settings:
73 | CPU: AnyCPU
74 | userData:
75 | assetBundleName:
76 | assetBundleVariant:
77 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/SpriteMovement.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs;
2 | using Unity.Entities;
3 | using Unity.Mathematics;
4 | using Unity.Transforms;
5 | using UnityEngine;
6 |
7 | namespace SpriteSheetRendererExamples
8 | {
9 | public class SpriteMovement : MonoBehaviour
10 | {
11 | public static Entity Sprite;
12 | const float m_speed = 3.0f;
13 | const float m_360RotationTime = 500;
14 |
15 | [SerializeField] bool m_moving;
16 | [SerializeField] bool m_rotating;
17 | float3 m_startPosition;
18 |
19 | private void Start()
20 | {
21 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
22 | m_startPosition = eManager.GetComponentData(Sprite).Position;
23 | }
24 |
25 | void Update()
26 | {
27 | // MY_CMP_ERROR
28 |
29 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
30 |
31 | if (m_rotating)
32 | {
33 | var timePassed = (Time.realtimeSinceStartup % m_360RotationTime);
34 | var rotationPercent = timePassed / m_360RotationTime;
35 | var angle = 360.0f * rotationPercent;
36 | var rot = quaternion.RotateZ(angle);
37 |
38 | // eManager.SetComponentData(Sprite, new Rotation { Value = rot });
39 | }
40 |
41 | if (!m_moving)
42 | return;
43 |
44 | var percent = (Time.realtimeSinceStartup % 1.0f);
45 | var offset = new float2(1) * ((percent * m_speed) - m_speed / 2);
46 | var pos = m_startPosition + new float3(offset, 0);
47 |
48 | using var transform = new ComponentReference(Sprite);
49 | transform.Value().Position = pos;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderInformation.cs:
--------------------------------------------------------------------------------
1 | using Unity.Entities;
2 | using UnityEngine;
3 |
4 | namespace SmokGnu.SpriteSheetRenderer.Render
5 | {
6 | public class RenderInformation
7 | {
8 | public uint[] args;
9 | public ComputeBuffer argsBuffer;
10 | public Entity renderGroup;
11 | public ComputeBuffer colorsBuffer;
12 | public ComputeBuffer indexBuffer;
13 | public Material material;
14 | public ComputeBuffer matrixBuffer;
15 | public int spriteCount;
16 | public bool updateUvs;
17 | public ComputeBuffer uvBuffer;
18 |
19 | public RenderInformation(Material material, int materialLength, Entity renderGroup)
20 | {
21 | this.material = material;
22 | spriteCount = materialLength;
23 | this.renderGroup = renderGroup;
24 | args = new uint[5] {0, 0, 0, 0, 0};
25 | argsBuffer = new ComputeBuffer(1, args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
26 | //thoose args are always the same since we always use the same mesh
27 | args[0] = (uint) 6;
28 | args[2] = args[3] = (uint) 0;
29 | updateUvs = true;
30 | }
31 |
32 | public void DestroyBuffers()
33 | {
34 | if (matrixBuffer != null)
35 | matrixBuffer.Release();
36 | matrixBuffer = null;
37 |
38 | if (argsBuffer != null)
39 | argsBuffer.Release();
40 | argsBuffer = null;
41 |
42 | if (colorsBuffer != null)
43 | colorsBuffer.Release();
44 | colorsBuffer = null;
45 |
46 | if (uvBuffer != null)
47 | uvBuffer.Release();
48 | uvBuffer = null;
49 |
50 | if (indexBuffer != null)
51 | indexBuffer.Release();
52 | indexBuffer = null;
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/Entity3DFactory.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS;
2 | using Unity.Entities;
3 | using Unity.Mathematics;
4 | using Unity.Transforms;
5 |
6 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs
7 | {
8 | public class Entity3DFactory
9 | {
10 | public EntityDefinition DefinitionScale3D { get; }
11 | public EntityDefinition Definition { get; }
12 | private EntityManager EntityManager => World.DefaultGameObjectInjectionWorld.EntityManager;
13 |
14 | public Entity3DFactory()
15 | {
16 | Definition = new EntityDefinition(new ComponentType[]
17 | {
18 | typeof(LocalTransform), typeof(LocalToWorld)
19 | });
20 |
21 | DefinitionScale3D =
22 | new EntityDefinition(Definition.ComponentTypes.Concat(typeof(PostTransformMatrix)));
23 | }
24 |
25 | public Entity Create3DEntity(string name = "dummy",
26 | float3? scale3D = null,
27 | Entity? parent = null)
28 | {
29 | var entity = EntityManager.CreateEntity(name, DefinitionScale3D.Archetype);
30 |
31 | Init3DEntity(entity, scale3D);
32 | if (parent != null)
33 | {
34 | EntityManager.SetComponentData(entity, new Parent { Value = parent.GetValueOrDefault(Entity.Null) });
35 | }
36 |
37 | return entity;
38 | }
39 |
40 | public void Init3DEntity(Entity entity, float3? scale3D = null)
41 | {
42 | EntityManager.SetComponentData(entity, LocalTransform.Identity);
43 |
44 | var scaleMatrix = float4x4.Scale(scale3D.GetValueOrDefault(Float3V.One));
45 | EntityManager.SetComponentData(entity, new PostTransformMatrix { Value = scaleMatrix });
46 |
47 | // cmp_err?
48 | // EntityTransformUtils.SetRootPositionUpdateLTW(entity, float3.zero);
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/BulkSpawnSprites[DEMO]/SpawnSpritesTestSettings.lighting:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!850595691 &4890085278179872738
4 | LightingSettings:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_Name: SpawnSpritesTestSettings
10 | serializedVersion: 3
11 | m_GIWorkflowMode: 1
12 | m_EnableBakedLightmaps: 0
13 | m_EnableRealtimeLightmaps: 0
14 | m_RealtimeEnvironmentLighting: 1
15 | m_BounceScale: 1
16 | m_AlbedoBoost: 1
17 | m_IndirectOutputScale: 1
18 | m_UsingShadowmask: 1
19 | m_BakeBackend: 1
20 | m_LightmapMaxSize: 1024
21 | m_BakeResolution: 40
22 | m_Padding: 2
23 | m_TextureCompression: 1
24 | m_AO: 0
25 | m_AOMaxDistance: 1
26 | m_CompAOExponent: 1
27 | m_CompAOExponentDirect: 0
28 | m_ExtractAO: 0
29 | m_MixedBakeMode: 2
30 | m_LightmapsBakeMode: 1
31 | m_FilterMode: 1
32 | m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
33 | m_ExportTrainingData: 0
34 | m_TrainingDataDestination: TrainingData
35 | m_RealtimeResolution: 2
36 | m_ForceWhiteAlbedo: 0
37 | m_ForceUpdates: 0
38 | m_FinalGather: 0
39 | m_FinalGatherRayCount: 256
40 | m_FinalGatherFiltering: 1
41 | m_PVRCulling: 1
42 | m_PVRSampling: 1
43 | m_PVRDirectSampleCount: 32
44 | m_PVRSampleCount: 512
45 | m_PVREnvironmentSampleCount: 256
46 | m_PVREnvironmentReferencePointCount: 2048
47 | m_LightProbeSampleCountMultiplier: 4
48 | m_PVRBounces: 2
49 | m_PVRMinBounces: 2
50 | m_PVREnvironmentMIS: 1
51 | m_PVRFilteringMode: 1
52 | m_PVRDenoiserTypeDirect: 1
53 | m_PVRDenoiserTypeIndirect: 1
54 | m_PVRDenoiserTypeAO: 1
55 | m_PVRFilterTypeDirect: 0
56 | m_PVRFilterTypeIndirect: 0
57 | m_PVRFilterTypeAO: 0
58 | m_PVRFilteringGaussRadiusDirect: 1
59 | m_PVRFilteringGaussRadiusIndirect: 5
60 | m_PVRFilteringGaussRadiusAO: 2
61 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
62 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
63 | m_PVRFilteringAtrousPositionSigmaAO: 1
64 |
--------------------------------------------------------------------------------
/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: 5
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_JobOptions:
23 | serializedVersion: 2
24 | useMultithreading: 0
25 | useConsistencySorting: 0
26 | m_InterpolationPosesPerJob: 100
27 | m_NewContactsPerJob: 30
28 | m_CollideContactsPerJob: 100
29 | m_ClearFlagsPerJob: 200
30 | m_ClearBodyForcesPerJob: 200
31 | m_SyncDiscreteFixturesPerJob: 50
32 | m_SyncContinuousFixturesPerJob: 50
33 | m_FindNearestContactsPerJob: 100
34 | m_UpdateTriggerContactsPerJob: 100
35 | m_IslandSolverCostThreshold: 100
36 | m_IslandSolverBodyCostScale: 1
37 | m_IslandSolverContactCostScale: 10
38 | m_IslandSolverJointCostScale: 10
39 | m_IslandSolverBodiesPerJob: 50
40 | m_IslandSolverContactsPerJob: 50
41 | m_SimulationMode: 0
42 | m_QueriesHitTriggers: 1
43 | m_QueriesStartInColliders: 1
44 | m_CallbacksOnDisable: 1
45 | m_ReuseCollisionCallbacks: 1
46 | m_AutoSyncTransforms: 0
47 | m_AlwaysShowColliders: 0
48 | m_ShowColliderSleep: 1
49 | m_ShowColliderContacts: 0
50 | m_ShowColliderAABB: 0
51 | m_ContactArrowScale: 0.2
52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
57 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | #
4 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
5 | #
6 | /[Ll]ibrary/
7 | /[Tt]emp/
8 | /[Oo]bj/
9 | /[Bb]uild/
10 | /[Bb]uilds/
11 | /[Ll]ogs/
12 | /[Uu]ser[Ss]ettings/
13 |
14 | # MemoryCaptures can get excessive in size.
15 | # They also could contain extremely sensitive data
16 | /[Mm]emoryCaptures/
17 |
18 | # Asset meta data should only be ignored when the corresponding asset is also ignored
19 | !/[Aa]ssets/**/*.meta
20 |
21 | # Uncomment this line if you wish to ignore the asset store tools plugin
22 | # /[Aa]ssets/AssetStoreTools*
23 |
24 | # Autogenerated Jetbrains Rider plugin
25 | /[Aa]ssets/Plugins/Editor/JetBrains*
26 |
27 | # Visual Studio cache directory
28 | .vs/
29 |
30 | # Gradle cache directory
31 | .gradle/
32 |
33 | # Autogenerated VS/MD/Consulo solution and project files
34 | ExportedObj/
35 | .consulo/
36 | *.csproj
37 | *.csproj.meta
38 | *.unityproj
39 | *.sln
40 | *.suo
41 | *.tmp
42 | *.user
43 | *.userprefs
44 | *.pidb
45 | *.booproj
46 | *.svd
47 | *.pdb
48 | *.mdb
49 | *.opendb
50 | *.VC.db
51 |
52 | # Unity3D generated meta files
53 | *.pidb.meta
54 | *.pdb.meta
55 | *.mdb.meta
56 |
57 | # Unity3D generated file on crash reports
58 | sysinfo.txt
59 |
60 | # Related to this issue https://issuetracker.unity3d.com/issues/testrunner-playmode-test-leaves-behind-inittestscene-dot-dot-dot-scene-assets-after-test-runs
61 | **/InitTestScene*
62 |
63 | # Builds
64 | *.apk
65 | *.unitypackage
66 | *.unitypackage.meta
67 |
68 | # Crashlytics generated file
69 | crashlytics-build.properties
70 | /Assets/Editor/Build/node_modules/
71 | /Assets/Editor/Build/package-lock.json
72 |
73 |
74 | # Common IntelliJ Platform excludes - based on https://github.com/JetBrains/resharper-rider-samples/blob/master/.gitignore
75 |
76 | # User specific
77 | **/.idea/**/workspace.xml
78 | **/.idea/**/tasks.xml
79 | **/.idea/shelf/*
80 | **/.idea/dictionaries
81 | **/.idea/httpRequests/
82 |
83 | # Sensitive or high-churn files
84 | **/.idea/**/dataSources/
85 | **/.idea/**/dataSources.ids
86 | **/.idea/**/dataSources.xml
87 | **/.idea/**/dataSources.local.xml
88 | **/.idea/**/sqlDataSources.xml
89 | **/.idea/**/dynamic.xml
90 |
91 | # Rider
92 | # Rider auto-generates .iml files, and contentModel.xml
93 | **/.idea/**/*.iml
94 | **/.idea/**/contentModel.xml
95 | **/.idea/**/modules.xml
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleSpawnSprite[DEMO]/Script/SingleSpriteSheetSpawner.cs:
--------------------------------------------------------------------------------
1 | // using System.Collections;
2 | // using System.Collections.Generic;
3 | // using Unity.Entities;
4 | // using Unity.Mathematics;
5 | // using Unity.Transforms;
6 | // using UnityEngine;
7 | //
8 | // namespace SpriteSheetRendererExamples
9 | // {
10 | // public class SingleSpriteSheetSpawner : MonoBehaviour, IConvertGameObjectToEntity
11 | // {
12 | // public Sprite[] sprites;
13 | //
14 | // public void Convert(Entity entity, EntityManager eManager, GameObjectConversionSystem conversionSystem)
15 | // {
16 | // // 1) Create Archetype
17 | // //EntityArchetype archetype = eManager.CreateArchetype(
18 | // // typeof(Position2D),
19 | // // typeof(Rotation2D),
20 | // // typeof(Scale),
21 | // // //required params
22 | // // typeof(SpriteIndex),
23 | // // typeof(SpriteSheetAnimation),
24 | // // typeof(SpriteSheetMaterial),
25 | // // typeof(SpriteSheetColor),
26 | // // typeof(SpriteMatrix),
27 | // // typeof(BufferHook)
28 | // // );
29 | //
30 | // //// 2) Record and bake this spritesheet(only once)
31 | // //SpriteSheetManager.Instance.RecordSpriteSheet(sprites, "emoji");
32 | //
33 | // //int maxSprites = SpriteSheetCache.Instance.GetLength("emoji");
34 | // //var color = UnityEngine.Random.ColorHSV(.35f, .85f);
35 | //
36 | // //// 4) Instantiate the entity
37 | // //Entity e = SpriteSheetManager.Instance.Instantiate(archetype, "emoji");
38 | //
39 | // //// 3) Populate components
40 | // //eManager.AddComponentData(e, new Position2D { Value = float2.zero });
41 | // //eManager.AddComponentData(e, new Scale { Value = 15 });
42 | // //eManager.AddComponentData(e, new SpriteIndex { Value = UnityEngine.Random.Range(0, maxSprites) });
43 | // //eManager.AddComponentData(e, new SpriteSheetAnimation { maxSprites = maxSprites, play = true, repetition = SpriteSheetAnimation.RepetitionType.Loop, samples = 10 });
44 | // //eManager.AddComponentData(e, new SpriteSheetColor { color = new float4(color.r, color.g, color.b, color.a) });
45 | // }
46 | // }
47 | // }
--------------------------------------------------------------------------------
/Assets/Runtime/Material/SpriteSheetMaterial.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: SpriteSheetMaterial
11 | m_Shader: {fileID: 4800000, guid: 0ed81ae0394d38648af7d38739801948, type: 3}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: 2450
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 2800000, guid: 77150084b79374b0dbbe39f040cc3b80, type: 3}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.534
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 1, g: 1, b: 1, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/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: 13
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_VideoShadersIncludeMode: 2
32 | m_AlwaysIncludedShaders:
33 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
34 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
35 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
36 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
37 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
38 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
39 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
40 | m_PreloadedShaders: []
41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
42 | m_CustomRenderPipeline: {fileID: 0}
43 | m_TransparencySortMode: 0
44 | m_TransparencySortAxis: {x: 0, y: 0, z: 1}
45 | m_DefaultRenderingPath: 1
46 | m_DefaultMobileRenderingPath: 1
47 | m_TierSettings: []
48 | m_LightmapStripping: 0
49 | m_FogStripping: 0
50 | m_InstancingStripping: 0
51 | m_LightmapKeepPlain: 1
52 | m_LightmapKeepDirCombined: 1
53 | m_LightmapKeepDynamicPlain: 1
54 | m_LightmapKeepDynamicDirCombined: 1
55 | m_LightmapKeepShadowMask: 1
56 | m_LightmapKeepSubtractive: 1
57 | m_FogKeepLinear: 1
58 | m_FogKeepExp: 1
59 | m_FogKeepExp2: 1
60 | m_AlbedoSwatchInfos: []
61 | m_LightsUseLinearIntensity: 0
62 | m_LightsUseColorTemperature: 0
63 | m_LogWhenShaderIsCompiled: 0
64 |
--------------------------------------------------------------------------------
/Assets/Runtime/AnimationScriptable.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2fc6d812fd1aa3d46bc6f87967c97db7
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 11
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 | vTOnly: 0
27 | ignoreMasterTextureLimit: 0
28 | grayScaleToAlpha: 0
29 | generateCubemap: 6
30 | cubemapConvolution: 0
31 | seamlessCubemap: 0
32 | textureFormat: 1
33 | maxTextureSize: 2048
34 | textureSettings:
35 | serializedVersion: 2
36 | filterMode: 1
37 | aniso: 1
38 | mipBias: 0
39 | wrapU: 1
40 | wrapV: 1
41 | wrapW: 1
42 | nPOTScale: 0
43 | lightmap: 0
44 | compressionQuality: 50
45 | spriteMode: 1
46 | spriteExtrude: 1
47 | spriteMeshType: 1
48 | alignment: 0
49 | spritePivot: {x: 0.5, y: 0.5}
50 | spritePixelsToUnits: 100
51 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
52 | spriteGenerateFallbackPhysicsShape: 1
53 | alphaUsage: 1
54 | alphaIsTransparency: 1
55 | spriteTessellationDetail: -1
56 | textureType: 8
57 | textureShape: 1
58 | singleChannelComponent: 0
59 | flipbookRows: 1
60 | flipbookColumns: 1
61 | maxTextureSizeSet: 0
62 | compressionQualitySet: 0
63 | textureFormatSet: 0
64 | ignorePngGamma: 0
65 | applyGammaDecoding: 0
66 | platformSettings:
67 | - serializedVersion: 3
68 | buildTarget: DefaultTexturePlatform
69 | maxTextureSize: 2048
70 | resizeAlgorithm: 0
71 | textureFormat: -1
72 | textureCompression: 1
73 | compressionQuality: 50
74 | crunchedCompression: 0
75 | allowsAlphaSplitting: 0
76 | overridden: 0
77 | androidETC2FallbackOverride: 0
78 | forceMaximumCompressionQuality_BC6H_BC7: 0
79 | spriteSheet:
80 | serializedVersion: 2
81 | sprites: []
82 | outline: []
83 | physicsShape: []
84 | bones: []
85 | spriteID: 5e97eb03825dee720800000000000000
86 | internalID: 0
87 | vertices: []
88 | indices:
89 | edges: []
90 | weights: []
91 | secondaryTextures: []
92 | nameFileIdTable: {}
93 | spritePackingTag:
94 | pSDRemoveMatte: 0
95 | pSDShowRemoveMatteOption: 0
96 | userData:
97 | assetBundleName:
98 | assetBundleVariant:
99 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/DynamicAnimationsDemoInit.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer;
2 | using SmokGnu.SpriteSheetRenderer.Render;
3 | using SmokGnu.SpriteSheetRenderer.ScriptableObject;
4 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs;
5 | using Unity.Entities;
6 | using Unity.Mathematics;
7 | using Unity.Transforms;
8 | using UnityEngine;
9 |
10 | namespace SpriteSheetRendererExamples
11 | {
12 |
13 | //MY_CMP_ERROR
14 | public class DynamicAnimationsDemoInit : MonoBehaviour
15 | {
16 | [SerializeField] private Shader _shader;
17 |
18 | public static Entity character;
19 | public SpriteSheetAnimator animator;
20 | public Shader Shader => _shader;
21 | private static EntityManager EntityManager => World.DefaultGameObjectInjectionWorld.EntityManager;
22 |
23 | private void Awake()
24 | {
25 | SpriteSheetRendererInit.Init(Shader);
26 |
27 | var factory3D = new Entity3DFactory();
28 | var sFactory = new SpriteSheetFactory(factory3D);
29 | // SpriteSheetCache.Instance.Init(authoring.Shader);
30 |
31 | var spriteSheetRenderSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged();
32 | spriteSheetRenderSystem.RecordAnimator(animator);
33 |
34 |
35 | // 4) Instantiate the entity
36 | // character = eManager.CreateEntity(archetype);
37 |
38 |
39 | character = EntityManager.CreateEntity(sFactory.AnimatedSprite3DDefinition.Archetype);
40 | sFactory.InitAnimatedSprite(character, animator);
41 | //eManager.SetName(character, "DynamicAnimationsDemo");
42 | // 3) Populate components
43 | var trs = LocalTransform.FromPositionRotationScale(new float3(15), quaternion.identity, 1);
44 | EntityManager.AddComponentData(character, trs);
45 | var pts = new PostTransformMatrix() { Value = float4x4.Scale(2) };
46 | // var vec = pts.Value.GetScale();
47 | EntityManager.AddComponentData(character, pts);
48 | // var color = Color.white;
49 | // eManager.AddComponentData(character, new Translation { Value = new float3(15) });
50 | // cmp_err
51 | // eManager.AddComponentData(character, new NonUniformScale { Value = new float3(-3, 7, 0) });
52 | // eManager.AddComponentData(character, new SpriteSheetColor { Value = new float4(color.r, color.g, color.b, color.a) });
53 |
54 | SpriteMovement.Sprite = character;
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/EntityManagerNameExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using Unity.Collections;
3 | using Unity.Entities;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS
6 | {
7 | internal static class EntityManagerNameExtensions
8 | {
9 | private const string kBaseEntityIndexName = "{0}: "; // 0 is entity index
10 | private const string Null = "Null";
11 |
12 | [Conditional("UNITY_EDITOR")]
13 | public static void SetNameIndexed(this EntityManager entityManager, Entity entity, string name)
14 | {
15 | #if UNITY_EDITOR
16 | entityManager.SetName(entity, string.Format(kBaseEntityIndexName + name, entity.Index));
17 | #endif
18 | }
19 |
20 | public static string GetNameEditor(this EntityManager eManager, Entity entity)
21 | {
22 | if (entity == Entity.Null)
23 | return Null;
24 |
25 | #if UNITY_EDITOR
26 | return eManager.GetName(entity);
27 | #else
28 | return string.Empty;
29 | #endif
30 | }
31 |
32 | public static Entity CreateEntity(this EntityManager entityManager, string name, params ComponentType[] types)
33 | {
34 | var entity = entityManager.CreateEntity(types);
35 | entityManager.SetNameIndexed(entity, name);
36 | return entity;
37 | }
38 |
39 | public static Entity CreateEntity(this EntityManager entityManager, string name, EntityArchetype entityArchetype)
40 | {
41 | var entity = entityManager.CreateEntity(entityArchetype);
42 | entityManager.SetNameIndexed(entity, name);
43 | return entity;
44 | }
45 |
46 | public static Entity CreateEntity(this EntityManager entityManager, string name)
47 | {
48 | var entity = entityManager.CreateEntity();
49 | entityManager.SetNameIndexed(entity, name);
50 | return entity;
51 | }
52 |
53 | public static Entity Instantiate(this EntityManager entityManager, string name, Entity srcEntity)
54 | {
55 | var entity = entityManager.Instantiate(srcEntity);
56 | entityManager.SetNameIndexed(entity, name);
57 | return entity;
58 | }
59 |
60 | public static void Instantiate(this EntityManager entityManager, string name, Entity srcEntity,
61 | NativeArray outputEntities)
62 | {
63 | entityManager.Instantiate(srcEntity, outputEntities);
64 | foreach (var entity in outputEntities)
65 | entityManager.SetNameIndexed(entity, name);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/SingleEntityDestroy[DEMO]/Scripts/SingleEntityDestroy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Unity.Entities;
3 | using UnityEngine;
4 |
5 | namespace SpriteSheetRendererExamples
6 | {
7 | public class SingleEntityDestroy : MonoBehaviour//, IConvertGameObjectToEntity
8 | {
9 | public Sprite[] sprites;
10 |
11 | // public void Convert(Entity entity, EntityManager eManager, GameObjectConversionSystem conversionSystem)
12 | // {
13 | // throw new NotImplementedException();
14 | // //Record and bake this spritesheets(only once)
15 | // archetype = eManager.CreateArchetype(
16 | // typeof(LocalToWorld),
17 | // //typeof(Rotation2D),
18 | // // typeof(Scale),
19 | // typeof(LifeTime),
20 | // //required params
21 | // typeof(SpriteIndex),
22 | // typeof(SpriteSheetAnimationComponent),
23 | // typeof(Material),
24 | // typeof(SpriteSheetColor),
25 | // //typeof(SpriteMatrix),
26 | // typeof(SpriteSheetRenderGroupHookComponent)
27 | // );
28 | // // SpriteSheetManager.Instance.RecordSpriteSheet(sprites, "emoji");
29 | // }
30 |
31 | EntityArchetype archetype;
32 |
33 | void Update()
34 | {
35 | if (Input.GetKeyDown(KeyCode.Space))
36 | {
37 | // int maxSprites = SpriteSheetCache.Instance.GetLength("emoji");
38 | var color = UnityEngine.Random.ColorHSV(.35f, .85f);
39 |
40 |
41 | throw new NotImplementedException();
42 |
43 | // 3) Populate components
44 | // List components = new List
45 | // {
46 | // //new Position2D { Value = UnityEngine.Random.insideUnitCircle * 7 },
47 | // //new Position2D { Value = UnityEngine.Random.insideUnitCircle * 7 },
48 | // new Scale {Value = UnityEngine.Random.Range(0, 3f)},
49 | // // new SpriteIndex {Value = UnityEngine.Random.Range(0, maxSprites)},
50 | // // new SpriteSheetAnimationComponent { maxSprites = maxSprites, isPlaying = true, repetition = SpriteSheetAnimationComponent.RepetitionType.Loop, samples = 10 },
51 | // new SpriteSheetColor {Value = new float4(color.r, color.g, color.b, color.a)},
52 | // new LifeTime {Value = UnityEngine.Random.Range(5, 15)}
53 | // };
54 |
55 | // SpriteSheetManager.Instance.Instantiate(archetype, "emoji");
56 | }
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/SpriteSheetFactory.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Animation;
2 | using SmokGnu.SpriteSheetRenderer.Animation.Components;
3 | using SmokGnu.SpriteSheetRenderer.Render.RenderGroup;
4 | using SmokGnu.SpriteSheetRenderer.ScriptableObject;
5 | using SmokGnu.SpriteSheetRenderer.Utils;
6 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs;
7 | using Unity.Entities;
8 | using UnityEngine;
9 |
10 | namespace SmokGnu.SpriteSheetRenderer
11 | {
12 | public class SpriteSheetFactory
13 | {
14 | private static EntityManager EntityManager => World.DefaultGameObjectInjectionWorld.EntityManager;
15 | private readonly Entity3DFactory _entity3DFactory;
16 |
17 | public EntityDefinition AnimatedSprite3DDefinition { get; }
18 | public EntityDefinition StaticSpriteArchetype { get; }
19 |
20 | public SpriteSheetFactory(Entity3DFactory entity3DFactory)
21 | {
22 | _entity3DFactory = entity3DFactory;
23 | var staticSpriteComponentTypes = new ComponentType[]
24 | {
25 | typeof(SpriteIndex), typeof(SpriteSheetColor), typeof(SpriteSheetRenderGroupHookComponent)
26 | };
27 | var animatedSpriteComponentTypes = staticSpriteComponentTypes.Concat(typeof(SpriteSheetAnimationComponent));
28 | AnimatedSprite3DDefinition = new EntityDefinition(entity3DFactory.DefinitionScale3D.ComponentTypes.Concat(animatedSpriteComponentTypes));
29 | StaticSpriteArchetype = new EntityDefinition(entity3DFactory.DefinitionScale3D.ComponentTypes.Concat(staticSpriteComponentTypes));
30 | }
31 |
32 | public void InitAnimatedSprite(Entity entity, SpriteSheetAnimator animator = null)
33 | {
34 | if (animator != null)
35 | {
36 | var startAnim = animator.animations[animator.defaultAnimationIndex];
37 | SpriteSheetAnimationSystem.SetAnimation(entity, startAnim.RenderGroup);
38 | // DebugExtensions.LogVar(new { spriteSheetEntity = spriteSheetEntity.Stringify(), animator }, "SpriteSheetManager.Init");
39 | }
40 |
41 | InitSprite(entity);
42 | }
43 |
44 | public void InitStaticSprite(Entity spriteSheetEntity, StaticSpriteScriptable staticSprite)
45 | {
46 | RenderGroup.AddToNewRenderGroup(spriteSheetEntity, staticSprite.RenderGroup);
47 | InitSprite(spriteSheetEntity);
48 | }
49 |
50 | private void InitSprite(Entity sprite)
51 | {
52 | _entity3DFactory.Init3DEntity(sprite);
53 | EntityManager.SetComponentData(sprite, new SpriteSheetColor {Value = (Vector4) Color.white});
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/CollectionUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace SmokGnu.SpriteSheetRenderer.Utils
7 | {
8 | public static class CollectionUtils
9 | {
10 | public static bool IsValidIndex(this List list, int index)
11 | {
12 | return index >= 0 && index < list.Count;
13 | }
14 |
15 | public static void AddRange(this List list, int count, T element = default)
16 | {
17 | var newCount = list.Count + count;
18 | if (newCount > list.Capacity)
19 | {
20 | list.Capacity = newCount;
21 | }
22 |
23 | for (var i = 0; i < count; i++)
24 | {
25 | list.Add(element);
26 | }
27 | }
28 |
29 | public static void Resize(this List list, int size, T element = default)
30 | {
31 | var count = list.Count;
32 |
33 | if (size < count)
34 | {
35 | list.RemoveRange(size, count - size);
36 | }
37 | else if (size > count)
38 | {
39 | if (size > list.Capacity)
40 | list.Capacity = size;
41 |
42 | list.AddRange(size - count, element);
43 | }
44 | }
45 |
46 | public static void GetKeys(this Dictionary dict, List outKeys)
47 | {
48 | outKeys.Clear();
49 | outKeys.Capacity = dict.Keys.Count;
50 |
51 | foreach (var key in dict.Keys)
52 | {
53 | outKeys.Add(key);
54 | }
55 | }
56 |
57 | public static T[] Concat(this T[] left, params T[] right)
58 | {
59 | var result = new T[left.Length + right.Length];
60 | left.CopyTo(result, 0);
61 | right.CopyTo(result, left.Length);
62 | return result;
63 | }
64 |
65 | public static T[] Concat(this T[] a1, T[] a2, T[] a3)
66 | {
67 | var resultSize = a1.Length + a2.Length + a3.Length;
68 | var result = new T[resultSize];
69 | a1.CopyTo(result, 0);
70 | a2.CopyTo(result, a1.Length);
71 | a3.CopyTo(result, a1.Length + a2.Length);
72 | return result;
73 | }
74 |
75 | public static Stream ToStream(this string value) => ToStream(value, Encoding.UTF8);
76 |
77 | public static Stream ToStream(this string value, Encoding encoding)
78 | => new MemoryStream(encoding.GetBytes(value ?? string.Empty));
79 |
80 | public static bool Contains(this T[] arr, T value) => Array.IndexOf(arr, value) != -1;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Assets/Runtime/Material/SpriteSheet.shader:
--------------------------------------------------------------------------------
1 | Shader "Instanced/SpriteSheet" {
2 | Properties {
3 | _MainTex ("Albedo (RGB)", 2D) = "white" {}
4 | }
5 |
6 | SubShader {
7 | Tags{
8 | "Queue"="Transparent"
9 | "IgnoreProjector"="True"
10 | "RenderType"="Transparent"
11 | }
12 | Cull Off
13 | Lighting Off
14 | ZWrite On
15 | Blend One OneMinusSrcAlpha
16 | Pass {
17 | //CGPROGRAM
18 | HLSLPROGRAM
19 | // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it uses non-square matrices
20 | #pragma exclude_renderers gles
21 |
22 | #pragma vertex vert
23 | #pragma fragment frag
24 | //#pragma target 4.5
25 | #pragma target 3.0
26 | #include "UnityCG.cginc"
27 |
28 | sampler2D _MainTex;
29 |
30 | StructuredBuffer matrixBuffer;
31 | StructuredBuffer indexBuffer;
32 | StructuredBuffer uvBuffer;
33 | StructuredBuffer colorsBuffer;
34 |
35 | //RWStructuredBuffer _DebugBuffer : register(u1);
36 |
37 | struct v2f{
38 | float4 pos : SV_POSITION;
39 | float2 uv: TEXCOORD0;
40 | fixed4 color : COLOR0;
41 | };
42 |
43 | float4x4 rotationZMatrix(float rZ){
44 | float angleZ = radians(rZ);
45 | float c = cos(angleZ);
46 | float s = sin(angleZ);
47 | float4x4 ZMatrix =
48 | float4x4(
49 | c, -s, 0, 0,
50 | s, c, 0, 0,
51 | 0, 0, 1, 0,
52 | 0, 0, 0, 1);
53 | return ZMatrix;
54 | }
55 |
56 | v2f vert (appdata_full v, uint instanceID : SV_InstanceID){
57 | float4x4 model = matrixBuffer[instanceID];
58 | float4 uv = uvBuffer[indexBuffer[instanceID]];
59 | // todo: construct full MVP on cpu and pass to shader - using camera.worldToCameraMatrix and projectionMatrix does not seem to work
60 | float4 worldPosition = mul(model, v.vertex-float4(0.5,0.5,0,0));
61 | v2f o;
62 | o.pos = mul(UNITY_MATRIX_VP, worldPosition);
63 | o.uv = v.texcoord * uv.xy + uv.zw;
64 | o.color = colorsBuffer[instanceID];
65 |
66 | //_DebugBuffer[0] = model;
67 | return o;
68 | }
69 |
70 | fixed4 frag (v2f i) : SV_Target{
71 | fixed4 col = tex2D(_MainTex, i.uv) * i.color;
72 | clip(col.a - 1.0 / 255.0);
73 | col.rgb *= col.a;
74 |
75 | return col;
76 | }
77 |
78 | ENDHLSL
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/DynamicAnimations[DEMO]/Scripts/DynamicAnimationsDemoBaker.cs:
--------------------------------------------------------------------------------
1 | namespace SpriteSheetRendererExamples
2 | {
3 | public class DynamicAnimationsDemoBaker// : Baker
4 | {
5 | public void Bake(DynamicAnimationsDemoInit init)
6 | {
7 | //eManager.SetNameInd(entity, "CONVERt ENTITY");
8 |
9 | // 1) Create Archetype
10 | // EntityArchetype archetype = eManager.CreateArchetype(
11 | // typeof(LocalToWorld),
12 | // typeof(Translation),
13 | // typeof(Rotation),
14 | // typeof(NonUniformScale),
15 | // //required params
16 | // typeof(SpriteIndex),
17 | // typeof(SpriteSheetAnimationComponent),
18 | // typeof(Material),
19 | // typeof(SpriteSheetColor),
20 | // typeof(SpriteSheetRenderGroupHookComponent)
21 | // );
22 |
23 | // SpriteSheetRendererInit.Init(init.Shader);
24 | //
25 | // var factory3D = new Entity3DFactory();
26 | // var sFactory = new SpriteSheetFactory(factory3D);
27 | // // SpriteSheetCache.Instance.Init(authoring.Shader);
28 | //
29 | // var spriteSheetRenderSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged();
30 | // spriteSheetRenderSystem.RecordAnimator(init.animator);
31 | //
32 | //
33 | // // 4) Instantiate the entity
34 | // // character = eManager.CreateEntity(archetype);
35 | //
36 | //
37 | // var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
38 | // DynamicAnimationsDemoInit.character = eManager.CreateEntity(sFactory.AnimatedSpriteComponentTypes);
39 | // sFactory.InitAnimatedSprite(DynamicAnimationsDemoInit.character, init.animator);
40 | // //eManager.SetName(character, "DynamicAnimationsDemo");
41 | // // 3) Populate components
42 | // var trs = LocalTransform.FromPositionRotationScale(new float3(15), quaternion.identity, 1);
43 | // eManager.AddComponentData(DynamicAnimationsDemoInit.character, trs);
44 | // // var color = Color.white;
45 | // // eManager.AddComponentData(character, new Translation { Value = new float3(15) });
46 | // // cmp_err
47 | // // eManager.AddComponentData(character, new NonUniformScale { Value = new float3(-3, 7, 0) });
48 | // // eManager.AddComponentData(character, new SpriteSheetColor { Value = new float4(color.r, color.g, color.b, color.a) });
49 | //
50 | // SpriteMovement.Sprite = DynamicAnimationsDemoInit.character;
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Examples/CameraController.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace SpriteSheetRendererExamples
4 | {
5 | public class CameraController : MonoBehaviour
6 | {
7 | public static bool isBuildingState = false;
8 |
9 | public LayerMask IgnoreMe;
10 | public float zoomOutMax = 100;
11 | public float zoomOutMin = 10;
12 |
13 |
14 | public void MoveMainCamera(Vector3 touch)
15 | {
16 | var direction = touch - Camera.main.ScreenToWorldPoint(Input.mousePosition);
17 | Camera.main.transform.position += direction * Speed * Time.deltaTime;
18 | }
19 |
20 |
21 | private static void MoveScreenWhenCloseToBorder()
22 | {
23 |
24 | if ((Screen.width * 0.85 < Input.mousePosition.x) || (Input.mousePosition.x < Screen.width * 0.15))
25 | {
26 | Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), 1f * Time.deltaTime);
27 | }
28 | if ((Screen.height * 0.85 < Input.mousePosition.y) || (Input.mousePosition.y < Screen.height * 0.01))
29 | {
30 | Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), 1f * Time.deltaTime);
31 | }
32 | }
33 |
34 | [SerializeField] float MobileZoomSpeed;
35 | [SerializeField] float PCZoomSpeed;
36 |
37 | [SerializeField] float Speed;
38 |
39 | float m_zoomSpeed;
40 | Vector3 touchStart;
41 |
42 | private void Start()
43 | {
44 | if (SystemInfo.deviceType == DeviceType.Handheld)
45 | {
46 | m_zoomSpeed = MobileZoomSpeed;
47 | }
48 | else
49 | {
50 | m_zoomSpeed = PCZoomSpeed;
51 | }
52 | }
53 |
54 | void Update()
55 | {
56 | if (Input.GetMouseButtonDown(0))
57 | {
58 | touchStart = Camera.main.ScreenToWorldPoint(Input.mousePosition);
59 | }
60 |
61 | if (Input.touchCount == 2)
62 | {
63 | var touchZero = Input.GetTouch(0);
64 | var touchOne = Input.GetTouch(1);
65 |
66 | var touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
67 | var touchOnePrevPos = touchOne.position - touchOne.deltaPosition;
68 |
69 | var prevMagnitude = (touchZeroPrevPos - touchOnePrevPos).magnitude;
70 | var currentMagnitude = (touchZero.position - touchOne.position).magnitude;
71 |
72 | var difference = currentMagnitude - prevMagnitude;
73 |
74 | zoom(difference * 0.1f);
75 | }
76 |
77 | else if (Input.GetMouseButton(0) && !isBuildingState)
78 | {
79 | MoveMainCamera(touchStart);
80 | }
81 | if (isBuildingState)
82 | {
83 | MoveScreenWhenCloseToBorder();
84 | }
85 |
86 | zoom(Input.GetAxis("Mouse ScrollWheel"));
87 | }
88 |
89 |
90 | void zoom(float increment)
91 | {
92 | increment *= Time.deltaTime * m_zoomSpeed;
93 | Camera.main.orthographicSize = Mathf.Clamp(Camera.main.orthographicSize - increment, zoomOutMin, zoomOutMax);
94 | }
95 | }
96 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/SpriteSheetCache.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Unity.Mathematics;
3 | using UnityEngine;
4 |
5 | namespace SmokGnu.SpriteSheetRenderer.Render
6 | {
7 | public class SpriteSheetCache
8 | {
9 | readonly Shader m_spriteSheetShader;
10 | readonly Dictionary> materialNameMaterial = new();
11 | readonly Dictionary materialToName = new();
12 |
13 | public SpriteSheetCache(Shader spriteSheetShader)
14 | {
15 | m_spriteSheetShader = spriteSheetShader;
16 | }
17 |
18 | public KeyValuePair BakeSprites(Sprite[] sprites, string materialName)
19 | {
20 | var material = new Material(m_spriteSheetShader);
21 | Texture texture = sprites[0].texture;
22 | material.mainTexture = texture;
23 |
24 | if (sprites.Length == 1)
25 | return BakeSprite(sprites[0], materialName);
26 |
27 | float w = texture.width;
28 | float h = texture.height;
29 | var uvs = new float4[sprites.Length];
30 | var i = 0;
31 | foreach (var s in sprites)
32 | {
33 | var tilingX = 1f / (w / s.rect.width);
34 | var tilingY = 1f / (h / s.rect.height);
35 | var OffsetX = tilingX * (s.rect.x / s.rect.width);
36 | var OffsetY = tilingY * (s.rect.y / s.rect.height);
37 | uvs[i].x = tilingX;
38 | uvs[i].y = tilingY;
39 | uvs[i].z = OffsetX;
40 | uvs[i].w = OffsetY;
41 | i++;
42 | }
43 |
44 | materialNameMaterial.Add(materialName, new KeyValuePair(material, sprites.Length));
45 | materialToName.Add(material, materialName);
46 | return new KeyValuePair(material, uvs);
47 | }
48 |
49 | public KeyValuePair BakeSprite(Sprite sprite, string materialName)
50 | {
51 | var material = new Material(m_spriteSheetShader);
52 | Texture texture = sprite.texture;
53 | material.mainTexture = texture;
54 | float w = texture.width;
55 | float h = texture.height;
56 |
57 | const int length = 1;
58 | var uvs = new float4[length];
59 | var tilingX = 1f / (w / sprite.rect.width);
60 | var tilingY = 1f / (h / sprite.rect.height);
61 | var OffsetX = tilingX * (sprite.rect.x / sprite.rect.width);
62 | var OffsetY = tilingY * (sprite.rect.y / sprite.rect.height);
63 | uvs[0].x = tilingX;
64 | uvs[0].y = tilingY;
65 | uvs[0].z = OffsetX;
66 | uvs[0].w = OffsetY;
67 | materialNameMaterial.Add(materialName, new KeyValuePair(material, length));
68 | materialToName.Add(material, materialName);
69 | return new KeyValuePair(material, uvs);
70 | }
71 |
72 | public int TotalLength() => materialNameMaterial.Count;
73 |
74 | public int GetLength(string spriteSheetName) => materialNameMaterial[spriteSheetName].Value;
75 | public Material GetMaterial(string spriteSheetName) => materialNameMaterial[spriteSheetName].Key;
76 |
77 | public string GetMaterialName(Material material) => materialToName[material];
78 | public int GetLength(Material material) => GetLength(GetMaterialName(material));
79 | }
80 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Render/RenderGroup/Components/RenderGroupComponents.cs:
--------------------------------------------------------------------------------
1 | using SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS;
2 | using System;
3 | using Unity.Collections.LowLevel.Unsafe;
4 | using Unity.Entities;
5 | using Unity.Mathematics;
6 | using UnityEngine;
7 |
8 | namespace SmokGnu.SpriteSheetRenderer.Render.RenderGroup.Components
9 | {
10 | [InternalBufferCapacity(16)]
11 | public struct MatrixBuffer : IBufferElementData
12 | {
13 | public static implicit operator float4x4(MatrixBuffer e) { return e.matrix; }
14 | public static implicit operator MatrixBuffer(float4x4 e) { return new MatrixBuffer { matrix = e }; }
15 | public float4x4 matrix;
16 |
17 | public static DynamicBuffer GetMatrixBuffer(Entity entity)
18 | {
19 | var eManager = World.DefaultGameObjectInjectionWorld.EntityManager;
20 | return eManager.GetBuffer(entity).Reinterpret();
21 | }
22 |
23 | public static int SizeOf() => UnsafeUtility.SizeOf();
24 | }
25 |
26 | [InternalBufferCapacity(8)]
27 | public struct SpriteColorBufferElement : IBufferElementData
28 | {
29 | public static implicit operator float4(SpriteColorBufferElement e) { return e.color; }
30 | public static implicit operator SpriteColorBufferElement(float4 e) { return new SpriteColorBufferElement {color = e}; }
31 | public float4 color;
32 |
33 | public static DynamicBuffer GetColors(Entity e) => DotsCollectionUtils.GetReinterprettedBuffer(e);
34 | }
35 |
36 | [InternalBufferCapacity(sizeof(int))]
37 | public struct SpriteIndexBuffer : IBufferElementData
38 | {
39 | public static implicit operator int(SpriteIndexBuffer e)
40 | {
41 | return e.index;
42 | }
43 |
44 | public static implicit operator SpriteIndexBuffer(int e)
45 | {
46 | return new SpriteIndexBuffer {index = e};
47 | }
48 |
49 | public int index;
50 |
51 | public static DynamicBuffer GetSpriteIndices(Entity e) => DotsCollectionUtils.GetReinterprettedBuffer(e);
52 | }
53 |
54 | // This describes the number of buffer elements that should be reserved
55 | // in chunk data for each instance of a buffer. In this case, 8 integers
56 | // will be reserved (32 bytes) along with the size of the buffer header
57 | // (currently 16 bytes on 64-bit targets)
58 | [InternalBufferCapacity(8)]
59 | public struct UvBuffer : IBufferElementData
60 | {
61 | public float4 Value;
62 | public static DynamicBuffer GetUV(Entity e) => DotsCollectionUtils.GetReinterprettedBuffer(e);
63 | }
64 |
65 | public struct RenderedEntityBufferElement : IBufferElementData
66 | {
67 | public Entity Value;
68 |
69 | public static DynamicBuffer GetRenderedEntities(Entity e) =>
70 | DotsCollectionUtils.GetReinterprettedBuffer(e);
71 | }
72 |
73 | public enum RepetitionType
74 | {
75 | Invalid,
76 | Once,
77 | Loop,
78 | PingPong
79 | }
80 |
81 | [Serializable]
82 | public struct SpriteSheetAnimationDefinitionComponent : IComponentData
83 | {
84 | public float Duration;
85 | public RepetitionType Repetition;
86 |
87 | [HideInInspector]
88 | public float FrameDuration;
89 | [HideInInspector]
90 | public int SpriteCount;
91 | [HideInInspector]
92 | public int? EventFrame;
93 | }
94 | }
--------------------------------------------------------------------------------
/Assets/Runtime/Scripts/Utils/TMUtilsEcs/DOTS/DotsDebugUtils.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using Unity.Collections;
6 | using Unity.Entities;
7 | using UnityEngine;
8 |
9 | namespace SmokGnu.SpriteSheetRenderer.Utils.TMUtilsEcs.DOTS
10 | {
11 | public static class DotsDebugUtils
12 | {
13 | public static string GetEnityInfo(Entity entity)
14 | {
15 | var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
16 | var entityManagerDebug = new EntityManager.EntityManagerDebug(entityManager);
17 | return entityManagerDebug.GetEntityInfo(entity);
18 | }
19 |
20 | public static List