├── Assets.meta ├── Assets ├── ScriptableEventIcon.png ├── ScriptableEventIcon.png.meta ├── ScriptableEventListenerIcon.png ├── ScriptableEventListenerIcon.png.meta ├── ScriptableSoundIcon.png ├── ScriptableSoundIcon.png.meta ├── ScriptableVariableIcon.png └── ScriptableVariableIcon.png.meta ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Editor.meta ├── Editor ├── ScriptableSoundEditor.cs ├── ScriptableSoundEditor.cs.meta ├── TinyTools.Editor.asmdef ├── TinyTools.Editor.asmdef.meta ├── TinyToolsSettingsEditor.cs └── TinyToolsSettingsEditor.cs.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── AutoLoad.meta ├── AutoLoad │ ├── AutoLoadAttribute.cs │ ├── AutoLoadAttribute.cs.meta │ ├── AutoLoadManager.cs │ └── AutoLoadManager.cs.meta ├── Core.meta ├── Core │ ├── TinyToolsConstants.cs │ ├── TinyToolsConstants.cs.meta │ ├── TinyToolsSettings.cs │ └── TinyToolsSettings.cs.meta ├── Extensions.meta ├── Extensions │ ├── ListExtensions.cs │ ├── ListExtensions.cs.meta │ ├── ScriptableObjectExtensions.cs │ └── ScriptableObjectExtensions.cs.meta ├── Generics.meta ├── Generics │ ├── Observable.cs │ ├── Observable.cs.meta │ ├── Singleton.cs │ ├── Singleton.cs.meta │ ├── WeightedList.cs │ └── WeightedList.cs.meta ├── ScriptableEvents.meta ├── ScriptableEvents │ ├── Events.meta │ ├── Events │ │ ├── BoolScriptableEvent.cs │ │ ├── BoolScriptableEvent.cs.meta │ │ ├── FloatScriptableEvent.cs │ │ ├── FloatScriptableEvent.cs.meta │ │ ├── IntScriptableEvent.cs │ │ ├── IntScriptableEvent.cs.meta │ │ ├── StringScriptableEvent.cs │ │ ├── StringScriptableEvent.cs.meta │ │ ├── Vector2ScriptableEvent.cs │ │ ├── Vector2ScriptableEvent.cs.meta │ │ ├── Vector3ScriptableEvent.cs │ │ ├── Vector3ScriptableEvent.cs.meta │ │ ├── VoidScriptableEvent.cs │ │ └── VoidScriptableEvent.cs.meta │ ├── Listeners.meta │ ├── Listeners │ │ ├── BoolScriptableEventListener.cs │ │ ├── BoolScriptableEventListener.cs.meta │ │ ├── FloatScriptableEventListener.cs │ │ ├── FloatScriptableEventListener.cs.meta │ │ ├── IntScriptableEventListener.cs │ │ ├── IntScriptableEventListener.cs.meta │ │ ├── StringScriptableEventListener.cs │ │ ├── StringScriptableEventListener.cs.meta │ │ ├── Vector2ScriptableEventListener.cs │ │ ├── Vector2ScriptableEventListener.cs.meta │ │ ├── Vector3ScriptableEventListener.cs │ │ ├── Vector3ScriptableEventListener.cs.meta │ │ ├── VoidScriptableEventListener.cs │ │ └── VoidScriptableEventListener.cs.meta │ ├── ScriptableEvent.cs │ ├── ScriptableEvent.cs.meta │ ├── ScriptableEventListener.cs │ └── ScriptableEventListener.cs.meta ├── ScriptableSounds.meta ├── ScriptableSounds │ ├── ScriptableSound.cs │ ├── ScriptableSound.cs.meta │ ├── ScriptableSoundManager.cs │ ├── ScriptableSoundManager.cs.meta │ ├── ScriptableSoundObject.cs │ ├── ScriptableSoundObject.cs.meta │ ├── ScriptableSoundPool.cs │ ├── ScriptableSoundPool.cs.meta │ ├── ScriptableSoundPriority.cs │ └── ScriptableSoundPriority.cs.meta ├── ScriptableVariables.meta ├── ScriptableVariables │ ├── ScriptableVariable.cs │ ├── ScriptableVariable.cs.meta │ ├── Variables.meta │ └── Variables │ │ ├── BoolScriptableVariable.cs │ │ ├── BoolScriptableVariable.cs.meta │ │ ├── FloatScriptableVariable.cs │ │ ├── FloatScriptableVariable.cs.meta │ │ ├── IntScriptableVariable.cs │ │ ├── IntScriptableVariable.cs.meta │ │ ├── StringScriptableVariable.cs │ │ ├── StringScriptableVariable.cs.meta │ │ ├── Vector2ScriptableVariable.cs │ │ ├── Vector2ScriptableVariable.cs.meta │ │ ├── Vector3ScriptableVariable.cs │ │ └── Vector3ScriptableVariable.cs.meta ├── TinyTools.asmdef └── TinyTools.asmdef.meta ├── Samples.meta ├── Samples ├── ScriptableSounds.meta └── ScriptableSounds │ ├── BoopAudio.wav │ ├── BoopAudio.wav.meta │ ├── BoopScriptableSound.asset │ └── BoopScriptableSound.asset.meta ├── package.json └── package.json.meta /Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07eb772c955e2c74e9e9f096520903bf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ScriptableEventIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukebradaric/TinyTools/52fa42f68dc91b15eaba13d8594100fbbe2fdacf/Assets/ScriptableEventIcon.png -------------------------------------------------------------------------------- /Assets/ScriptableEventIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0362288f0994784497819543e08c455 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 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: 128 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 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: Standalone 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Server 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | spriteSheet: 105 | serializedVersion: 2 106 | sprites: [] 107 | outline: [] 108 | physicsShape: [] 109 | bones: [] 110 | spriteID: 5e97eb03825dee720800000000000000 111 | internalID: 0 112 | vertices: [] 113 | indices: 114 | edges: [] 115 | weights: [] 116 | secondaryTextures: [] 117 | nameFileIdTable: {} 118 | spritePackingTag: 119 | pSDRemoveMatte: 0 120 | pSDShowRemoveMatteOption: 0 121 | userData: 122 | assetBundleName: 123 | assetBundleVariant: 124 | -------------------------------------------------------------------------------- /Assets/ScriptableEventListenerIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukebradaric/TinyTools/52fa42f68dc91b15eaba13d8594100fbbe2fdacf/Assets/ScriptableEventListenerIcon.png -------------------------------------------------------------------------------- /Assets/ScriptableEventListenerIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ec7fc7a813e63e4780a84519dac76e7 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 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: 128 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 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: Standalone 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Server 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | spriteSheet: 105 | serializedVersion: 2 106 | sprites: [] 107 | outline: [] 108 | physicsShape: [] 109 | bones: [] 110 | spriteID: 5e97eb03825dee720800000000000000 111 | internalID: 0 112 | vertices: [] 113 | indices: 114 | edges: [] 115 | weights: [] 116 | secondaryTextures: [] 117 | nameFileIdTable: {} 118 | spritePackingTag: 119 | pSDRemoveMatte: 0 120 | pSDShowRemoveMatteOption: 0 121 | userData: 122 | assetBundleName: 123 | assetBundleVariant: 124 | -------------------------------------------------------------------------------- /Assets/ScriptableSoundIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukebradaric/TinyTools/52fa42f68dc91b15eaba13d8594100fbbe2fdacf/Assets/ScriptableSoundIcon.png -------------------------------------------------------------------------------- /Assets/ScriptableSoundIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b28afb590680ee4a872e6430c63b632 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 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 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: Standalone 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Server 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | spriteSheet: 105 | serializedVersion: 2 106 | sprites: [] 107 | outline: [] 108 | physicsShape: [] 109 | bones: [] 110 | spriteID: 5e97eb03825dee720800000000000000 111 | internalID: 0 112 | vertices: [] 113 | indices: 114 | edges: [] 115 | weights: [] 116 | secondaryTextures: [] 117 | nameFileIdTable: {} 118 | spritePackingTag: 119 | pSDRemoveMatte: 0 120 | pSDShowRemoveMatteOption: 0 121 | userData: 122 | assetBundleName: 123 | assetBundleVariant: 124 | -------------------------------------------------------------------------------- /Assets/ScriptableVariableIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukebradaric/TinyTools/52fa42f68dc91b15eaba13d8594100fbbe2fdacf/Assets/ScriptableVariableIcon.png -------------------------------------------------------------------------------- /Assets/ScriptableVariableIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02eb76f5286d4af4aa06d8086b3fa6bd 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 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 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: Standalone 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Server 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | spriteSheet: 105 | serializedVersion: 2 106 | sprites: [] 107 | outline: [] 108 | physicsShape: [] 109 | bones: [] 110 | spriteID: 5e97eb03825dee720800000000000000 111 | internalID: 0 112 | vertices: [] 113 | indices: 114 | edges: [] 115 | weights: [] 116 | secondaryTextures: [] 117 | nameFileIdTable: {} 118 | spritePackingTag: 119 | pSDRemoveMatte: 0 120 | pSDShowRemoveMatteOption: 0 121 | userData: 122 | assetBundleName: 123 | assetBundleVariant: 124 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #Changelog 2 | 3 | ## v2.0 - 28-9-2023 4 | 5 | - Scriptable Sounds 6 | - Scriptable Events 7 | - Scriptable Variables 8 | - AutoLoad Attribute 9 | - Various Extension Methods 10 | - Various Generic Classes 11 | - Complete Rework! 12 | 13 | ## v1.5.2 - 14-11-2021 14 | 15 | - Added Logging tool 16 | - Added MonoTimer Tool 17 | 18 | ## v1.5.0 - 27-10-2021 19 | 20 | - Added playable sound list to Audio Tool 21 | - Added optional var to Extras Tool 22 | 23 | ## v1.1.2 - 15-8-2021 24 | 25 | - Added Gizmo Tool 26 | - Added Extras Tool 27 | - Added Singleton and ScriptableObjectSingleton to core 28 | - Fixed demo sound not playing in edit mode 29 | - Fixed soundobjects being destroyed on every scene load 30 | - Fixed issue with audio assets playing in builds 31 | 32 | ## v1.1 - 3-8-2021 33 | 34 | - Fixed missing soundobject references when changing scenes 35 | 36 | ## v1.0 - 28-7-2021 37 | 38 | - Audio Tool 39 | - Camera Shake Tool 40 | - Extensions 41 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 493a5875e4e49184cbef51d2619d9b2a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1ac4a1638a200043a3ba7ae5a64aca9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/ScriptableSoundEditor.cs: -------------------------------------------------------------------------------- 1 | using TinyTools.ScriptableSounds; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace TinyTools.Editor 6 | { 7 | [CustomEditor(typeof(ScriptableSound), true)] 8 | [CanEditMultipleObjects] 9 | internal class ScriptableSoundEditor : UnityEditor.Editor 10 | { 11 | public override void OnInspectorGUI() 12 | { 13 | DrawDefaultInspector(); 14 | 15 | EditorGUILayout.Space(); 16 | if (GUILayout.Button("Play")) 17 | ((ScriptableSound)target).PlayEditor(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Editor/ScriptableSoundEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c9916aa4de38344ab9ff33725c2b12a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/TinyTools.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TinyTools.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:51407e3aa60f0aa46ab8b65c62cdf474" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Editor/TinyTools.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34f0ad4810e99274581eeb404ed2eb4d 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/TinyToolsSettingsEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using TinyTools.Core; 3 | using UnityEditor; 4 | 5 | namespace TinyTools.Editor 6 | { 7 | internal static class TinyToolsSettingsEditor 8 | { 9 | [SettingsProvider] 10 | public static SettingsProvider CreateTinyToolsSettingsProvider() 11 | { 12 | HashSet propertyNames = new HashSet(); 13 | var settings = new SerializedObject(TinyToolsSettings.GetOrCreateSettings()); 14 | SerializedProperty property = settings.GetIterator(); 15 | while (property.NextVisible(true)) 16 | { 17 | propertyNames.Add(property.name); 18 | } 19 | 20 | SettingsProvider provider = new SettingsProvider(TinyToolsConstants.ProjectSettingsPath, SettingsScope.Project) 21 | { 22 | label =TinyToolsConstants.Name, 23 | guiHandler = (searchContext) => 24 | { 25 | foreach (string propertyName in propertyNames) 26 | { 27 | EditorGUILayout.PropertyField(settings.FindProperty(propertyName)); 28 | } 29 | settings.ApplyModifiedProperties(); 30 | }, 31 | keywords = propertyNames 32 | }; 33 | 34 | return provider; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Editor/TinyToolsSettingsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05a4976259b555441a65c4b2d482ea3f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Luke Bradaric 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d37828462b1bdae43b00d770afc822ce 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![TinyTools_Banner_Thin](https://user-images.githubusercontent.com/49044096/137410737-378af617-22de-4df8-8daa-1a693997b752.png) 2 | 3 | ### Lightweight collection of easy to use Unity tools 4 | 5 | - Scriptable Sounds 6 | - Scriptable Events 7 | - Scriptable Variables 8 | - AutoLoad Attribute 9 | - Various Extension Methods 10 | - Various Generic Classes 11 | 12 | ### Getting Started 13 | 14 | - Window > Package Manager > Add Package from git URL 15 | - https://github.com/lukebradaric/TinyTools.git 16 | 17 | ![image](https://github.com/lukebradaric/TinyTools/assets/49044096/a5e29bc7-b716-4f5a-b4d9-eee69bbf2bdb) 18 | 19 | 20 | ### Version History 21 | 22 | - 2.0 TinyTools Rework! 23 | - 1.6 Logging Added 24 | - 1.5 Gizmos & Extras Added 25 | - 1.4 CameraShake Component Added 26 | - 1.3 Audio System Reworked 27 | - 1.2 Extensions Added 28 | - 1.1 Audio System Added 29 | - 1.0 Initial Release 30 | 31 | ### Acknowledgments 32 | 33 | - https://github.com/DapperDino/Dapper-Tools 34 | - https://www.youtube.com/channel/UCX_b3NNQN5bzExm-22-NVVg 35 | 36 | Stars are appreciated :smile: 37 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b71a2fee45b54f246b534c449fd38c9e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e319ac3d6dea14f4395a73a3761751f6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/AutoLoad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a44ef6b932b2a3b498e1b1fe22436754 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/AutoLoad/AutoLoadAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TinyTools.AutoLoad 4 | { 5 | public class AutoLoadAttribute : Attribute { } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/AutoLoad/AutoLoadAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18a3928990bccc54a8b280055c750d40 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/AutoLoad/AutoLoadManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using UnityEngine; 4 | 5 | namespace TinyTools.AutoLoad 6 | { 7 | public class AutoLoadManager 8 | { 9 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] 10 | private static void Load() 11 | { 12 | foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) 13 | { 14 | foreach (Type type in assembly.GetTypes()) 15 | { 16 | if (type.GetCustomAttributes(typeof(AutoLoadAttribute), true).Length > 0) 17 | { 18 | // If object already exists, don't load 19 | if (UnityEngine.Object.FindObjectOfType(type) != null) 20 | { 21 | Debug.LogWarning($"{type.Name} already exists."); 22 | continue; 23 | } 24 | 25 | // If object is not of MonoBehaviour type, don't load 26 | if (!type.IsSubclassOf(typeof(MonoBehaviour))) 27 | { 28 | Debug.LogError($"{nameof(AutoLoadAttribute)} cannot be applied to non-MonoBehaviour. ({type.Name})"); 29 | continue; 30 | } 31 | 32 | // Instantiate gameobject 33 | GameObject gameObject = new GameObject(type.Name); 34 | gameObject.AddComponent(type); 35 | 36 | // Mark gameObject to not be destroyed 37 | GameObject.DontDestroyOnLoad(gameObject); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Runtime/AutoLoad/AutoLoadManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b066f4032f337304f9758c084f84917a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aaea6909b8d03e0438cc25fbe0372115 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Core/TinyToolsConstants.cs: -------------------------------------------------------------------------------- 1 | namespace TinyTools.Core 2 | { 3 | public static class TinyToolsConstants 4 | { 5 | public const string Name = "TinyTools"; 6 | 7 | public const string SettingsFilePath = "Assets/Resources/TinyToolsSettings.asset"; 8 | public const string SettingsFolderPath = "Assets/Resources"; 9 | public const string SettingsFolder = "Resources"; 10 | 11 | public const string ProjectSettingsPath = "Project/TinyToolsSettings"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Runtime/Core/TinyToolsConstants.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5eaf9add0eb74e04799374d5ffa9b67f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Core/TinyToolsSettings.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | #endif 4 | 5 | using UnityEngine; 6 | 7 | namespace TinyTools.Core 8 | { 9 | public class TinyToolsSettings : ScriptableObject 10 | { 11 | [Space] 12 | [Header("Sound")] 13 | [Tooltip("Should there be a limit on how many times one Audio Asset can be played in a second? (Helps to reduce sound clutter)")] 14 | [SerializeField] private bool _enablePlayRateLimit = false; 15 | public bool EnablePlayRateLimit => _enablePlayRateLimit; 16 | 17 | [Tooltip("The maximum amount of times an Audio Asset can be played in one second. (Eg. 10 = 10 times per second)")] 18 | [SerializeField] private float _maxPlayRatePerSecond = 10; 19 | public float MaxPlayRatePerSecond => _maxPlayRatePerSecond; 20 | 21 | [Tooltip("Time waited after playing audio before it is returned to the pool. (Prevents clipping)")] 22 | [SerializeField] private float _audioPlaytimeBuffer = 0.15f; 23 | public float AudioPlaytimeBuffer => _audioPlaytimeBuffer; 24 | 25 | public static TinyToolsSettings LoadSettings() 26 | { 27 | TinyToolsSettings settings = Resources.Load(nameof(TinyToolsSettings)); 28 | 29 | #if UNITY_EDITOR 30 | if (settings == null) 31 | { 32 | settings = GetOrCreateSettings(); 33 | } 34 | #endif 35 | 36 | if (settings == null) 37 | { 38 | Debug.LogError($"Unable to load TinyToolsSettings! Is the file in the correct path? {TinyToolsConstants.SettingsFilePath}"); 39 | } 40 | 41 | return settings; 42 | } 43 | 44 | #if UNITY_EDITOR 45 | public static TinyToolsSettings GetOrCreateSettings() 46 | { 47 | TinyToolsSettings settings = AssetDatabase.LoadAssetAtPath(TinyToolsConstants.SettingsFilePath); 48 | 49 | if (settings == null) 50 | { 51 | if (!AssetDatabase.IsValidFolder(TinyToolsConstants.SettingsFolderPath)) 52 | { 53 | AssetDatabase.CreateFolder("Assets", TinyToolsConstants.SettingsFolder); 54 | } 55 | 56 | settings = ScriptableObject.CreateInstance(); 57 | AssetDatabase.CreateAsset(settings, TinyToolsConstants.SettingsFilePath); 58 | AssetDatabase.SaveAssets(); 59 | } 60 | 61 | return settings; 62 | } 63 | #endif 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Runtime/Core/TinyToolsSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd6116a0a08944e488d68a75cc239f1a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 230e1446f232a994785c7e83b918c9f4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Extensions/ListExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TinyTools.Extensions 4 | { 5 | public static class ListExtensions 6 | { 7 | /// 8 | /// Return a random item from list 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static T Random(this IList list) 14 | { 15 | return list[UnityEngine.Random.Range(0, list.Count)]; 16 | } 17 | 18 | /// 19 | /// Removes and returns a random item from the list 20 | /// 21 | /// 22 | /// 23 | /// 24 | public static T RemoveRandom(this IList list) 25 | { 26 | int removeIndex = UnityEngine.Random.Range(0, list.Count); 27 | T item = list[removeIndex]; 28 | 29 | list.RemoveAt(removeIndex); 30 | 31 | return item; 32 | } 33 | 34 | /// 35 | /// Shuffles the list (Fisher-Yates algorithm) 36 | /// 37 | /// 38 | /// 39 | public static void Shuffle(this IList list) 40 | { 41 | // Algorithm used: 42 | // https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle 43 | 44 | var rand = new System.Random(); 45 | 46 | for (int i = list.Count - 1; i > 1; i--) 47 | { 48 | int k = rand.Next(i); 49 | T value = list[k]; 50 | list[k] = list[i]; 51 | list[i] = value; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Runtime/Extensions/ListExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da3711ae7a7b573489de5ca764851a3e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Extensions/ScriptableObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.Extensions 4 | { 5 | public static class ScriptableObjectExtensions 6 | { 7 | /// 8 | /// Returns a clone of the ScriptableObject 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static T GetClone(this T scriptableObject) where T : ScriptableObject 14 | { 15 | if (scriptableObject == null) 16 | { 17 | Debug.LogError($"ScriptableObject was null. Returning default {typeof(T)} object."); 18 | return (T)ScriptableObject.CreateInstance(typeof(T)); 19 | } 20 | 21 | T instance = Object.Instantiate(scriptableObject); 22 | instance.name = scriptableObject.name; // remove (Clone) from name 23 | return instance; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Runtime/Extensions/ScriptableObjectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ac7f12e67ebccb4d8ac47a798cd6744 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Generics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81f1d4fd34fad2f4fa09967793c4a87b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Generics/Observable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace TinyTools.Generics 5 | { 6 | [Serializable] 7 | public class Observable 8 | { 9 | public Observable() 10 | { 11 | _value = default; 12 | } 13 | 14 | public Observable(T value) 15 | { 16 | _value = value; 17 | } 18 | 19 | [SerializeField] private T _value; 20 | public T Value 21 | { 22 | get 23 | { 24 | return _value; 25 | } 26 | set 27 | { 28 | if (_value.Equals(value)) 29 | { 30 | return; 31 | } 32 | 33 | ValueChanging?.Invoke(_value, value); 34 | _value = value; 35 | ValueChanged?.Invoke(_value); 36 | } 37 | } 38 | 39 | // When the value has been changed 40 | public event Action ValueChanged; 41 | // When the value is going to change (current, new) 42 | public event Action ValueChanging; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Runtime/Generics/Observable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 768ed41afd0bc8e4c84a665d17caae15 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Generics/Singleton.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.Generics 4 | { 5 | public class Singleton : MonoBehaviour where T : Component 6 | { 7 | private static T _instance; 8 | public static T Instance 9 | { 10 | get 11 | { 12 | if (_instance == null) 13 | _instance = FindObjectOfType(); 14 | return _instance; 15 | } 16 | } 17 | 18 | protected virtual void Awake() 19 | { 20 | if (_instance == null) 21 | _instance = this as T; 22 | else if (_instance != this as T) 23 | { 24 | Debug.LogWarning($"More than one instance of {typeof(T).Name}! Destroying."); 25 | Destroy(gameObject); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Runtime/Generics/Singleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22e53ee0436b75d45b8b8a83da828e7f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Generics/WeightedList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace TinyTools.Generics 6 | { 7 | public class WeightedList 8 | { 9 | /// 10 | /// The current Count of items in the list 11 | /// 12 | public int Count => _items.Count; 13 | 14 | private List> _items = new List>(); 15 | private int _weightTotal = 0; 16 | 17 | /// 18 | /// Adds a weighted item to the list 19 | /// 20 | /// The item to add 21 | /// The weight of the item to add 22 | public void Add(T item, int weight) 23 | { 24 | _weightTotal += weight; 25 | _items.Add(new Tuple(item, _weightTotal)); 26 | } 27 | 28 | /// 29 | /// Returns a random item from the list 30 | /// (Calculated based on item weight) 31 | /// 32 | /// 33 | public T Random() 34 | { 35 | int randomWeight = UnityEngine.Random.Range(0, _weightTotal + 1); 36 | 37 | foreach (Tuple item in _items) 38 | { 39 | if (randomWeight <= item.Item2) 40 | return item.Item1; 41 | } 42 | 43 | Debug.LogError("Weighted random could not find valid item!"); 44 | return default(T); 45 | } 46 | 47 | /// 48 | /// Removes and returns a random item from the list 49 | /// (Calculated based on item weight) 50 | /// 51 | /// 52 | public T RemoveRandom() 53 | { 54 | if (_items.Count == 0) 55 | return default(T); 56 | 57 | int randomWeight = UnityEngine.Random.Range(0, _weightTotal + 1); 58 | 59 | foreach (Tuple item in _items) 60 | { 61 | if (randomWeight <= item.Item2) 62 | { 63 | _items.Remove(item); 64 | return item.Item1; 65 | } 66 | } 67 | 68 | Debug.LogError("Weighted random could not find valid item!"); 69 | return default(T); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Runtime/Generics/WeightedList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dccddf923baef4a41a7ca9108e067273 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1abc739300fdf594981d32ae33ffcee1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d72900f7b9a2314c916956482035920 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/BoolScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/BoolScriptableEvent")] 6 | public class BoolScriptableEvent : ScriptableEvent { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/BoolScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33c8f8f971dc78c4bbc27388cadcfdde 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/FloatScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/FloatScriptableEvent")] 6 | public class FloatScriptableEvent : ScriptableEvent { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/FloatScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 052b1db5fcee15946b11a2fcfd72fe24 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/IntScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/IntScriptableEvent")] 6 | public class IntScriptableEvent : ScriptableEvent { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/IntScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4366a38535f1df6438901404ce075204 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/StringScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/StringScriptableEvent")] 6 | public class StringScriptableEvent : ScriptableEvent { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/StringScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 328cb252532ec7143a2e804f4cf8721b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/Vector2ScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/Vector2ScriptableEvent")] 6 | public class Vector2ScriptableEvent : ScriptableEvent { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/Vector2ScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cefa124a04e279a4194682cfec2412b6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/Vector3ScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/Vector3ScriptableEvent")] 6 | public class Vector3ScriptableEvent : ScriptableEvent { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/Vector3ScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 100204e7c01911b4b9bff02e2ccac11d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/VoidScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace TinyTools.ScriptableEvents 5 | { 6 | [CreateAssetMenu(menuName = "TinyTools/ScriptableEvents/VoidScriptableEvent")] 7 | public class VoidScriptableEvent : ScriptableEvent 8 | { 9 | public void Raise() 10 | { 11 | base.Raise(null); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Events/VoidScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f57bfac30102d0a40a60ebf2c1edbe93 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: d0362288f0994784497819543e08c455, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7076461626e87d49a655e8bc9ff9814 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/BoolScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | namespace TinyTools.ScriptableEvents 2 | { 3 | public class BoolScriptableEventListener : ScriptableEventListener { } 4 | } 5 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/BoolScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 258cd42d691829b4fb26df59359ae745 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/FloatScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | namespace TinyTools.ScriptableEvents 2 | { 3 | public class FloatScriptableEventListener : ScriptableEventListener { } 4 | } 5 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/FloatScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fddc8a9792332654693c3450a4a33d0f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/IntScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | namespace TinyTools.ScriptableEvents 2 | { 3 | public class IntScriptableEventListener : ScriptableEventListener { } 4 | } 5 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/IntScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ceb49d4173c090b43a038d8b8c8f6866 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/StringScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | namespace TinyTools.ScriptableEvents 2 | { 3 | public class StringScriptableEventListener : ScriptableEventListener { } 4 | } 5 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/StringScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17035722091430247b05443b38c978e2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/Vector2ScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | public class Vector2ScriptableEventListener : ScriptableEventListener { } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/Vector2ScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84b15aca4d5a6ba498d21b9adbcdf362 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/Vector3ScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableEvents 4 | { 5 | public class Vector3ScriptableEventListener : ScriptableEventListener { } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/Vector3ScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a049242fff21d8440b2608700a6677f6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/VoidScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | 4 | namespace TinyTools.ScriptableEvents 5 | { 6 | public class VoidScriptableEventListener : MonoBehaviour 7 | { 8 | [SerializeField] private VoidScriptableEvent _scriptableEvent; 9 | [SerializeField] protected UnityEvent _onRaised; 10 | 11 | private void OnEnable() 12 | { 13 | _scriptableEvent.AddListener(this.OnRaised); 14 | } 15 | 16 | public virtual void OnRaised(object obj) 17 | { 18 | _onRaised.Invoke(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/Listeners/VoidScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 385111fb1665b3e499e8f6e346320274 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 6ec7fc7a813e63e4780a84519dac76e7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/ScriptableEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace TinyTools.ScriptableEvents 6 | { 7 | public abstract class ScriptableEvent : ScriptableEvent 8 | { 9 | public void Raise(T value) 10 | { 11 | for (int i = _listeners.Count - 1; i >= 0; i--) 12 | { 13 | _listeners[i].Invoke(value); 14 | } 15 | } 16 | } 17 | 18 | public abstract class ScriptableEvent : ScriptableObject 19 | { 20 | [Space] 21 | [Header("Options")] 22 | [TextArea][SerializeField] private string _description; 23 | 24 | protected readonly List> _listeners = new List>(); 25 | 26 | private void OnDisable() 27 | { 28 | _listeners.Clear(); 29 | } 30 | 31 | public void AddListener(Action listener) 32 | { 33 | _listeners.Add(listener); 34 | } 35 | 36 | public void RemoveListener(Action listener) 37 | { 38 | _listeners.Remove(listener); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/ScriptableEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d2375242cc56f942a3eadfc86e6b6db 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/ScriptableEventListener.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | 4 | namespace TinyTools.ScriptableEvents 5 | { 6 | public abstract class ScriptableEventListener : MonoBehaviour where TEvent : ScriptableEvent 7 | { 8 | [SerializeField] private TEvent _scriptableEvent; 9 | [SerializeField] protected UnityEvent _onRaised; 10 | 11 | private void OnEnable() 12 | { 13 | _scriptableEvent.AddListener(this.OnRaised); 14 | } 15 | 16 | public virtual void OnRaised(object value) 17 | { 18 | _onRaised.Invoke((T)value); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Runtime/ScriptableEvents/ScriptableEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89926360406a14d41b73942696071c69 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5997c147cdad79847af35f6f312d6fbf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSound.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Audio; 3 | 4 | namespace TinyTools.ScriptableSounds 5 | { 6 | [CreateAssetMenu(menuName = "TinyTools/ScriptableSound")] 7 | public class ScriptableSound : ScriptableObject 8 | { 9 | [Space] 10 | [Header("Components")] 11 | [Tooltip("The AudioClip to play.")] 12 | [SerializeField] private AudioClip _audioClip; 13 | public AudioClip AudioClip => _audioClip; 14 | 15 | [Tooltip("The Mixer Group to play the audio through. (Not required)")] 16 | [SerializeField] private AudioMixerGroup _audioMixerGroup; 17 | public AudioMixerGroup AudioMixerGroup => _audioMixerGroup; 18 | 19 | [Space] 20 | [Header("Settings")] 21 | [Tooltip("The priority of the audio.")] 22 | [SerializeField] private AudioPriority _audioPriority; 23 | public AudioPriority AudioPriority => _audioPriority; 24 | 25 | [Range(0f, 1f)] 26 | [SerializeField] private float _volume = 0.5f; 27 | public float Volume => _volume; 28 | 29 | [Range(-3f, 3f)] 30 | [SerializeField] private float _pitch = 1; 31 | public float Pitch 32 | { 33 | get 34 | { 35 | if (PitchVariation == 0) return _pitch; 36 | 37 | return Mathf.Clamp(_pitch + UnityEngine.Random.Range(-PitchVariation, PitchVariation), -3f, 3f); 38 | } 39 | } 40 | 41 | [Range(0f, 1f)] 42 | [Tooltip("The random variation in pitch each time the audio is played.")] 43 | [SerializeField] private float _pitchVariation = 0.0f; 44 | public float PitchVariation => _pitchVariation; 45 | 46 | [Tooltip("Should this Audio Asset ignore the max play rate? (How many times one sound can be played per second)")] 47 | [SerializeField] private bool _ignorePlayRateLimit = false; 48 | public bool IgnorePlayRateLimit => _ignorePlayRateLimit; 49 | 50 | /// 51 | /// Plays the Scriptable Sound. 52 | /// 53 | public void Play() 54 | { 55 | ScriptableSoundManager.Play(this); 56 | } 57 | 58 | #if UNITY_EDITOR 59 | public void PlayEditor() 60 | { 61 | ScriptableSoundManager.Play(this, true); 62 | } 63 | #endif 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSound.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eeaf3900e8f5acf4aa7fdcca3b5af590 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 7b28afb590680ee4a872e6430c63b632, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using TinyTools.AutoLoad; 4 | using TinyTools.Core; 5 | using TinyTools.Generics; 6 | using UnityEngine; 7 | 8 | namespace TinyTools.ScriptableSounds 9 | { 10 | [AutoLoad] 11 | internal class ScriptableSoundManager : Singleton 12 | { 13 | private static TinyToolsSettings _settings; 14 | public static TinyToolsSettings Settings 15 | { 16 | get 17 | { 18 | if (_settings == null) 19 | _settings = TinyToolsSettings.LoadSettings(); 20 | 21 | return _settings; 22 | } 23 | } 24 | 25 | private static ScriptableSoundPool _scriptableSoundPool = new ScriptableSoundPool(); 26 | 27 | private static HashSet _playRateLimits = new HashSet(); 28 | 29 | protected override void Awake() 30 | { 31 | base.Awake(); 32 | 33 | if (Settings.EnablePlayRateLimit) 34 | { 35 | StartCoroutine(PlayRateLimitCoroutine()); 36 | } 37 | } 38 | 39 | public static void Release(ScriptableSoundObject scriptableSoundObject) 40 | { 41 | _scriptableSoundPool.Release(scriptableSoundObject); 42 | } 43 | 44 | public static void Play(ScriptableSound scriptableSound, bool editorOnly = false) 45 | { 46 | if (scriptableSound == null) 47 | { 48 | Debug.LogWarning("Cannot play null ScriptableSound."); 49 | return; 50 | } 51 | 52 | if (Settings.EnablePlayRateLimit && !editorOnly) 53 | { 54 | // If sound doesn't ignore play rate limit and is found in the current limits, return 55 | if (!scriptableSound.IgnorePlayRateLimit && _playRateLimits.Contains(scriptableSound)) 56 | { 57 | return; 58 | } 59 | 60 | _playRateLimits.Add(scriptableSound); 61 | } 62 | 63 | ScriptableSoundObject scriptableSoundObject = editorOnly ? _scriptableSoundPool.GetTemporary() : _scriptableSoundPool.Get(); 64 | scriptableSoundObject.Load(scriptableSound); 65 | scriptableSoundObject.Play(!editorOnly); 66 | } 67 | 68 | private IEnumerator PlayRateLimitCoroutine() 69 | { 70 | yield return new WaitForSeconds(1 / Settings.MaxPlayRatePerSecond); 71 | _playRateLimits.Clear(); 72 | StartCoroutine(PlayRateLimitCoroutine()); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01cd065c179a2634b91943a1da437a30 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | namespace TinyTools.ScriptableSounds 5 | { 6 | internal class ScriptableSoundObject : MonoBehaviour 7 | { 8 | private AudioSource _audioSource; 9 | 10 | public void Load(ScriptableSound scriptableSound) 11 | { 12 | if (_audioSource == null) 13 | { 14 | _audioSource = gameObject.AddComponent(); 15 | } 16 | 17 | _audioSource.outputAudioMixerGroup = scriptableSound.AudioMixerGroup; 18 | _audioSource.clip = scriptableSound.AudioClip; 19 | _audioSource.priority = (int)scriptableSound.AudioPriority; 20 | _audioSource.volume = scriptableSound.Volume; 21 | _audioSource.pitch = scriptableSound.Pitch; 22 | } 23 | 24 | public void Play(bool autoRelease = true) 25 | { 26 | _audioSource.Play(); 27 | 28 | if (autoRelease) 29 | { 30 | StartCoroutine(ReleaseCoroutine()); 31 | } 32 | } 33 | 34 | private IEnumerator ReleaseCoroutine() 35 | { 36 | yield return new WaitForSeconds((_audioSource.clip.length / _audioSource.pitch) + ScriptableSoundManager.Settings.AudioPlaytimeBuffer); 37 | 38 | ScriptableSoundManager.Release(this); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f09e12d1a3486e947896543e943b8123 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundPool.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Pool; 3 | 4 | namespace TinyTools.ScriptableSounds 5 | { 6 | internal class ScriptableSoundPool 7 | { 8 | private ObjectPool _scriptableSoundObjectPool = new ObjectPool(Create, OnGet, OnRelease); 9 | 10 | public ScriptableSoundObject Get() => _scriptableSoundObjectPool.Get(); 11 | 12 | public ScriptableSoundObject GetTemporary() 13 | { 14 | ScriptableSoundObject scriptableSoundObject = Create(); 15 | scriptableSoundObject.gameObject.name = $"Editor{scriptableSoundObject.gameObject.name}"; 16 | scriptableSoundObject.gameObject.hideFlags = HideFlags.HideAndDontSave; 17 | return scriptableSoundObject; 18 | } 19 | 20 | public void Release(ScriptableSoundObject scriptableSoundObject) => _scriptableSoundObjectPool.Release(scriptableSoundObject); 21 | 22 | private static ScriptableSoundObject Create() 23 | { 24 | GameObject gameObject = new GameObject(nameof(ScriptableSoundObject)); 25 | 26 | if (ScriptableSoundManager.Instance != null) 27 | { 28 | gameObject.transform.SetParent(ScriptableSoundManager.Instance.transform); 29 | } 30 | 31 | ScriptableSoundObject scriptableSoundObject = gameObject.AddComponent(); 32 | return scriptableSoundObject; 33 | } 34 | 35 | private static void OnGet(ScriptableSoundObject scriptableSoundObject) 36 | { 37 | scriptableSoundObject.gameObject.SetActive(true); 38 | } 39 | 40 | private static void OnRelease(ScriptableSoundObject scriptableSoundObject) 41 | { 42 | scriptableSoundObject.gameObject.SetActive(false); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bdf1d55a1f4c4d4abd21b33bd11acca 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundPriority.cs: -------------------------------------------------------------------------------- 1 | namespace TinyTools.ScriptableSounds 2 | { 3 | public enum AudioPriority 4 | { 5 | VeryHigh = 0, 6 | High = 64, 7 | Medium = 128, 8 | Low = 192, 9 | VeryLow = 256 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableSounds/ScriptableSoundPriority.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72f7388374fc1d241b03a2f167c74ac9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fceca2e4c8ea944daa77c90f65091a6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/ScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | public abstract class ScriptableVariable : ScriptableObject 6 | { 7 | [SerializeField] private T _value; 8 | public T Value 9 | { 10 | get 11 | { 12 | return _value; 13 | } 14 | set 15 | { 16 | if (_readOnly) 17 | { 18 | Debug.LogWarning($"Tried to set read only value of {name}."); 19 | return; 20 | } 21 | 22 | _value = value; 23 | } 24 | } 25 | 26 | [Space] 27 | [Header("Options")] 28 | [SerializeField] private bool _readOnly = true; 29 | [TextArea][SerializeField] private string _description; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/ScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b20062f0c7cc78a40ae7fa3975f1dbbe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8d425b7a5d6c39429a3f352c21684c5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/BoolScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableVariables/BoolScriptableVariable")] 6 | public class BoolScriptableVariable : ScriptableVariable { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/BoolScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0587c8bbd9540964cbec20e53b28780b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 02eb76f5286d4af4aa06d8086b3fa6bd, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/FloatScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableVariables/FloatScriptableVariable")] 6 | public class FloatScriptableVariable : ScriptableVariable { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/FloatScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: adc268886b32f7f4baa1998317966600 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 02eb76f5286d4af4aa06d8086b3fa6bd, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/IntScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableVariables/IntScriptableVariable")] 6 | public class IntScriptableVariable : ScriptableVariable { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/IntScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6b3e610fd527f94ba9c8ec794cfe384 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 02eb76f5286d4af4aa06d8086b3fa6bd, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/StringScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableVariables/StringScriptableVariable")] 6 | public class StringScriptableVariable : ScriptableVariable { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/StringScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cf0ad7a70d53f041905c401917a91f2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 02eb76f5286d4af4aa06d8086b3fa6bd, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/Vector2ScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableVariables/Vector2ScriptableVariable")] 6 | public class Vector2ScriptableVariable : ScriptableVariable { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/Vector2ScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c7fa092e48ae7145a8f4e496fd49d65 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 02eb76f5286d4af4aa06d8086b3fa6bd, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/Vector3ScriptableVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TinyTools.ScriptableVariables 4 | { 5 | [CreateAssetMenu(menuName = "TinyTools/ScriptableVariables/Vector3ScriptableVariable")] 6 | public class Vector3ScriptableVariable : ScriptableVariable { } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ScriptableVariables/Variables/Vector3ScriptableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb5344961a145c143ab3fb3e9186be87 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 02eb76f5286d4af4aa06d8086b3fa6bd, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/TinyTools.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TinyTools" 3 | } 4 | -------------------------------------------------------------------------------- /Runtime/TinyTools.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51407e3aa60f0aa46ab8b65c62cdf474 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28ab6207f57b3ef4791b3cf8165577a6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/ScriptableSounds.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2864a53f6077de4f855c1d52e9e86e2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/ScriptableSounds/BoopAudio.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukebradaric/TinyTools/52fa42f68dc91b15eaba13d8594100fbbe2fdacf/Samples/ScriptableSounds/BoopAudio.wav -------------------------------------------------------------------------------- /Samples/ScriptableSounds/BoopAudio.wav.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99435d010f805234b9c62c939753bd72 3 | AudioImporter: 4 | externalObjects: {} 5 | serializedVersion: 6 6 | defaultSettings: 7 | loadType: 0 8 | sampleRateSetting: 0 9 | sampleRateOverride: 44100 10 | compressionFormat: 1 11 | quality: 1 12 | conversionMode: 0 13 | platformSettingOverrides: {} 14 | forceToMono: 0 15 | normalize: 1 16 | preloadAudioData: 1 17 | loadInBackground: 0 18 | ambisonic: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Samples/ScriptableSounds/BoopScriptableSound.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: eeaf3900e8f5acf4aa7fdcca3b5af590, type: 3} 13 | m_Name: BoopScriptableSound 14 | m_EditorClassIdentifier: 15 | _audioClip: {fileID: 8300000, guid: 99435d010f805234b9c62c939753bd72, type: 3} 16 | _audioMixerGroup: {fileID: 0} 17 | _audioPriority: 64 18 | _volume: 0.5 19 | _pitch: 1.5 20 | _pitchVariation: 0.1 21 | _ignorePlayRateLimit: 0 22 | -------------------------------------------------------------------------------- /Samples/ScriptableSounds/BoopScriptableSound.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 295b7f22d0422a2409cb21a5d5ace774 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.lukebradaric.tinytools", 3 | "version": "2.0.0", 4 | "displayName": "TinyTools", 5 | "description": "Lightweight collection of easy to use Unity tools.", 6 | "unity": "2018.1", 7 | "documentationUrl": "https://github.com/lukebradaric/TinyTools", 8 | "changelogUrl": "https://github.com/lukebradaric/TinyTools/releases", 9 | "licensesUrl": "https://github.com/lukebradaric/TinyTools/blob/main/LICENSE", 10 | "keywords": [ 11 | "tools", 12 | "lightweight", 13 | "easy" 14 | ], 15 | "author": { 16 | "name": "Luke Bradaric", 17 | "email": "lukebradaric@gmail.com", 18 | "url": "https://lukebradaric.com/" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 812faa3b2f22a1247a7414531ffb6cf9 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------