├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md └── workflows │ └── release.yml ├── .gitignore ├── .releaserc.json ├── AtlasImage.cs ├── AtlasImage.cs.meta ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Coffee.AtlasImage.asmdef ├── Coffee.AtlasImage.asmdef.meta ├── Editor.meta ├── Editor ├── AtlasImage Icon.png ├── AtlasImage Icon.png.meta ├── AtlasImageEditor.cs ├── AtlasImageEditor.cs.meta ├── Coffee.AtlasImage.Editor.asmdef ├── Coffee.AtlasImage.Editor.asmdef.meta ├── ImportSampleMenu.cs ├── ImportSampleMenu.cs.meta ├── SpritePreview.cs └── SpritePreview.cs.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Samples~ └── Demo │ ├── Demo_AtlasImage.asmdef │ ├── Demo_AtlasImage.asmdef.meta │ ├── Demo_AtlasImage.cs │ ├── Demo_AtlasImage.cs.meta │ ├── Demo_AtlasImage.spriteatlas │ ├── Demo_AtlasImage.spriteatlas.meta │ ├── Demo_AtlasImage.unity │ ├── Demo_AtlasImage.unity.meta │ ├── Sprites.meta │ └── Sprites │ ├── ammo-1.png │ ├── ammo-1.png.meta │ ├── ammo-2.png │ ├── ammo-2.png.meta │ ├── ammo-3.png │ ├── ammo-3.png.meta │ ├── ammo-4.png │ ├── ammo-4.png.meta │ ├── ammo-5.png │ ├── ammo-5.png.meta │ ├── ammo-6.png │ ├── ammo-6.png.meta │ ├── box.png │ ├── box.png.meta │ ├── cursor.png │ ├── cursor.png.meta │ ├── health-bar-box.png │ ├── health-bar-box.png.meta │ ├── health-bar.png │ └── health-bar.png.meta ├── package.json └── package.json.meta /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: mob-sakai # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: mob_sakai # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: mob-sakai 7 | 8 | --- 9 | 10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one. 11 | 12 | **Describe the bug** 13 | A clear and concise description of what the bug is. 14 | 15 | **To Reproduce** 16 | Steps to reproduce the behavior: 17 | 1. Go to '...' 18 | 2. Click on '....' 19 | 3. Scroll down to '....' 20 | 4. See error 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Environment (please complete the following information):** 29 | - Version [e.g. 1.0.0] 30 | - Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL] 31 | - Unity version: [e.g. 2018.2.8f1] 32 | - Build options: [e.g. IL2CPP, .Net 4.x, LWRP] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: mob-sakai 7 | 8 | --- 9 | 10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one. 11 | 12 | **Is your feature request related to a problem? Please describe.** 13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 14 | 15 | **Describe the solution you'd like** 16 | A clear and concise description of what you want to happen. 17 | 18 | **Describe alternatives you've considered** 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | **Additional context** 22 | Add any other context or screenshots about the feature request here. 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a question about this project 4 | title: '' 5 | labels: question 6 | assignees: mob-sakai 7 | 8 | --- 9 | 10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one. 11 | 12 | **Describe what help do you need** 13 | A description of the question. 14 | 15 | **Additional context** 16 | Add any other context or screenshots about the question here. 17 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | branches: 6 | - preview 7 | - main 8 | - v*.x 9 | tags-ignore: 10 | - "**" 11 | 12 | jobs: 13 | release: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v2 17 | 18 | - uses: cycjimmy/semantic-release-action@v2 19 | with: 20 | extra_plugins: | 21 | @semantic-release/changelog 22 | @semantic-release/git 23 | env: 24 | GITHUB_TOKEN: ${{ github.token }} 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | 21 | 22 | # Unity3D generated meta files 23 | *.pidb.meta 24 | 25 | # Unity3D Generated File On Crash Reports 26 | sysinfo.txt 27 | 28 | # Mac 29 | *.DS_Store 30 | 31 | # Builds 32 | *.apk 33 | 34 | 35 | # Packages 36 | *.unitypackage 37 | Samples~/Demo.meta 38 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branches": [ 3 | "+([0-9])?(.{+([0-9]),x}).x", 4 | "master", 5 | "main", 6 | { 7 | "name": "preview", 8 | "prerelease": true 9 | } 10 | ], 11 | "tagFormat": "${version}", 12 | "plugins": [ 13 | "@semantic-release/commit-analyzer", 14 | "@semantic-release/release-notes-generator", 15 | "@semantic-release/changelog", 16 | [ 17 | "@semantic-release/npm", 18 | { 19 | "npmPublish": false 20 | } 21 | ], 22 | "@semantic-release/git", 23 | "@semantic-release/github" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /AtlasImage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.U2D; 5 | using UnityEngine.UI; 6 | 7 | namespace Coffee.UIExtensions 8 | { 9 | /// 10 | /// Atlas image. 11 | /// 12 | public class AtlasImage : Image 13 | { 14 | [SerializeField] private string m_SpriteName; 15 | [SerializeField] private SpriteAtlas m_SpriteAtlas; 16 | private string _lastSpriteName = ""; 17 | 18 | 19 | /// Sprite Name. If there is no other sprite with the same name in the atlas, AtlasImage will display the default sprite. 20 | public string spriteName 21 | { 22 | get { return m_SpriteName; } 23 | set 24 | { 25 | if (m_SpriteName != value) 26 | { 27 | m_SpriteName = value; 28 | SetAllDirty(); 29 | } 30 | } 31 | } 32 | 33 | /// SpriteAtlas. Get and set atlas assets created by AtlasMaker. 34 | public SpriteAtlas spriteAtlas 35 | { 36 | get { return m_SpriteAtlas; } 37 | set 38 | { 39 | if (m_SpriteAtlas != value) 40 | { 41 | m_SpriteAtlas = value; 42 | SetAllDirty(); 43 | } 44 | } 45 | } 46 | 47 | /// 48 | /// Sets the material dirty. 49 | /// 50 | public override void SetMaterialDirty() 51 | { 52 | // Changing sprites from Animation. 53 | // If the "sprite" is changed by an animation or script, it will be reflected in the sprite name. 54 | if (_lastSpriteName == spriteName && sprite) 55 | { 56 | m_SpriteName = sprite.name.Replace("(Clone)", ""); 57 | } 58 | 59 | if (_lastSpriteName != spriteName) 60 | { 61 | _lastSpriteName = spriteName; 62 | sprite = spriteAtlas ? spriteAtlas.GetSprite(spriteName) : null; 63 | } 64 | 65 | base.SetMaterialDirty(); 66 | } 67 | 68 | 69 | protected AtlasImage() 70 | : base() 71 | { 72 | } 73 | 74 | /// 75 | /// Raises the populate mesh event. 76 | /// 77 | /// To fill. 78 | protected override void OnPopulateMesh(VertexHelper toFill) 79 | { 80 | if (!overrideSprite) 81 | { 82 | toFill.Clear(); 83 | return; 84 | } 85 | base.OnPopulateMesh(toFill); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /AtlasImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe06dca3567fe4d6b9bb6b93589315a5 3 | timeCreated: 1524805226 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {fileID: 2800000, guid: f1317203dc8d94fe2b2f200a87860e47, type: 3} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 (2020-12-28) 2 | 3 | 4 | ### Features 5 | 6 | * edit the border in the preview window ([7022a05](https://github.com/mob-sakai/AtlasImage/commit/7022a05674a957a58c9348aecd04537bb4bead55)) 7 | * impl ([2a7baca](https://github.com/mob-sakai/AtlasImage/commit/2a7baca8ab88ad3a05796aaa1a705dcf2231267a)) 8 | * in the inspector, sprite selection window shows only sprites in SpriteAtlas ([a7cddfc](https://github.com/mob-sakai/AtlasImage/commit/a7cddfc3fad432008df3532b9959fee84e3b20e8)) 9 | * sprite for renderring can be changed using a SpriteAtlas and a sprite name ([e12b969](https://github.com/mob-sakai/AtlasImage/commit/e12b969466f0d5265afc62500dc5e40280185b14)) 10 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9e1df97379aa4776bc521d29536a73a 3 | timeCreated: 1524986000 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Coffee.AtlasImage.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Coffee.AtlasImage", 3 | "references": [], 4 | "optionalUnityReferences": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [] 12 | } -------------------------------------------------------------------------------- /Coffee.AtlasImage.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5e7a20a1041b4f58942a2c878b686ff 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 144e5489e13264e0d91d295738b8459f 3 | folderAsset: yes 4 | timeCreated: 1524793042 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/AtlasImage Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Editor/AtlasImage Icon.png -------------------------------------------------------------------------------- /Editor/AtlasImage Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1317203dc8d94fe2b2f200a87860e47 3 | timeCreated: 1524805092 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | sRGBTexture: 0 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: 0 34 | aniso: 1 35 | mipBias: -1 36 | wrapU: 1 37 | wrapV: 1 38 | wrapW: 1 39 | nPOTScale: 0 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 1 51 | spriteTessellationDetail: -1 52 | textureType: 2 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 64 60 | textureFormat: -1 61 | textureCompression: 0 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | - buildTarget: Standalone 67 | maxTextureSize: 64 68 | textureFormat: -1 69 | textureCompression: 0 70 | compressionQuality: 50 71 | crunchedCompression: 0 72 | allowsAlphaSplitting: 0 73 | overridden: 0 74 | - buildTarget: iPhone 75 | maxTextureSize: 64 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | - buildTarget: Android 83 | maxTextureSize: 64 84 | textureFormat: -1 85 | textureCompression: 0 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | - buildTarget: WebGL 91 | maxTextureSize: 64 92 | textureFormat: -1 93 | textureCompression: 0 94 | compressionQuality: 50 95 | crunchedCompression: 0 96 | allowsAlphaSplitting: 0 97 | overridden: 0 98 | spriteSheet: 99 | serializedVersion: 2 100 | sprites: [] 101 | outline: [] 102 | physicsShape: [] 103 | spritePackingTag: 104 | userData: 105 | assetBundleName: 106 | assetBundleVariant: 107 | -------------------------------------------------------------------------------- /Editor/AtlasImageEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | using UnityEngine.UI; 4 | using UnityEditor; 5 | using UnityEditor.AnimatedValues; 6 | using UnityEditor.UI; 7 | using System.IO; 8 | using System.Linq; 9 | using Coffee.UIExtensions; 10 | using UnityEngine.U2D; 11 | using System.Reflection; 12 | 13 | namespace CoffeeEditor.UIExtensions 14 | { 15 | /// 16 | /// AtlasImage Editor. 17 | /// 18 | [CustomEditor(typeof(AtlasImage), true)] 19 | [CanEditMultipleObjects] 20 | public class AtlasImageEditor : ImageEditor 21 | { 22 | private static bool _openSelectorWindow = false; 23 | private static SpriteAtlas _lastSpriteAtlas; 24 | private readonly SpritePreview _preview = new SpritePreview(); 25 | private SerializedProperty _spAtlas; 26 | private SerializedProperty _spSpriteName; 27 | private SerializedProperty _spType; 28 | private SerializedProperty _spPreserveAspect; 29 | private AnimBool _animShowType; 30 | 31 | protected override void OnEnable() 32 | { 33 | if (!target) return; 34 | 35 | base.OnEnable(); 36 | _spAtlas = serializedObject.FindProperty("m_SpriteAtlas"); 37 | _spSpriteName = serializedObject.FindProperty("m_SpriteName"); 38 | _spType = serializedObject.FindProperty("m_Type"); 39 | _spPreserveAspect = serializedObject.FindProperty("m_PreserveAspect"); 40 | 41 | _animShowType = new AnimBool(_spAtlas.objectReferenceValue && !string.IsNullOrEmpty(_spSpriteName.stringValue)); 42 | _animShowType.valueChanged.AddListener(new UnityAction(base.Repaint)); 43 | 44 | _preview.onApplyBorder = () => 45 | { 46 | PackAtlas(_spAtlas.objectReferenceValue as SpriteAtlas); 47 | (target as AtlasImage).sprite = (_spAtlas.objectReferenceValue as SpriteAtlas).GetSprite(_spSpriteName.stringValue); 48 | }; 49 | 50 | _lastSpriteAtlas = null; 51 | } 52 | 53 | protected override void OnDisable() 54 | { 55 | base.OnDisable(); 56 | _preview.onApplyBorder = null; 57 | } 58 | 59 | public override void OnInspectorGUI() 60 | { 61 | serializedObject.Update(); 62 | 63 | DrawAtlasPopupLayout(new GUIContent("Sprite Atlas"), new GUIContent("-"), _spAtlas); 64 | EditorGUI.indentLevel++; 65 | DrawSpritePopup(_spAtlas.objectReferenceValue as SpriteAtlas, _spSpriteName); 66 | EditorGUI.indentLevel--; 67 | 68 | AppearanceControlsGUI(); 69 | RaycastControlsGUI(); 70 | 71 | _animShowType.target = _spAtlas.objectReferenceValue && !string.IsNullOrEmpty(_spSpriteName.stringValue); 72 | if (EditorGUILayout.BeginFadeGroup(_animShowType.faded)) 73 | this.TypeGUI(); 74 | EditorGUILayout.EndFadeGroup(); 75 | 76 | var imageType = (Image.Type) _spType.intValue; 77 | base.SetShowNativeSize(imageType == Image.Type.Simple || imageType == Image.Type.Filled, false); 78 | 79 | if (EditorGUILayout.BeginFadeGroup(m_ShowNativeSize.faded)) 80 | { 81 | EditorGUI.indentLevel++; 82 | EditorGUILayout.PropertyField(_spPreserveAspect); 83 | EditorGUI.indentLevel--; 84 | } 85 | 86 | EditorGUILayout.EndFadeGroup(); 87 | base.NativeSizeButtonGUI(); 88 | 89 | serializedObject.ApplyModifiedProperties(); 90 | 91 | // Draw preview 92 | var image = target as AtlasImage; 93 | _preview.sprite = GetOriginalSprite(image.spriteAtlas, image.spriteName); 94 | _preview.color = image ? image.canvasRenderer.GetColor() : Color.white; 95 | } 96 | 97 | public override GUIContent GetPreviewTitle() 98 | { 99 | return _preview.GetPreviewTitle(); 100 | } 101 | 102 | public override void OnPreviewGUI(Rect rect, GUIStyle background) 103 | { 104 | _preview.OnPreviewGUI(rect); 105 | } 106 | 107 | public override string GetInfoString() 108 | { 109 | return _preview.GetInfoString(); 110 | } 111 | 112 | public override void OnPreviewSettings() 113 | { 114 | _preview.OnPreviewSettings(); 115 | } 116 | 117 | public static void DrawAtlasPopupLayout(GUIContent label, GUIContent nullLabel, SerializedProperty atlas, UnityAction onChange = null, params GUILayoutOption[] option) 118 | { 119 | DrawAtlasPopup(GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup, option), label, nullLabel, atlas, onChange); 120 | } 121 | 122 | public static void DrawAtlasPopupLayout(GUIContent label, GUIContent nullLabel, SpriteAtlas atlas, UnityAction onChange = null, params GUILayoutOption[] option) 123 | { 124 | DrawAtlasPopup(GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup, option), label, nullLabel, atlas, onChange); 125 | } 126 | 127 | public static void DrawAtlasPopup(Rect rect, GUIContent label, GUIContent nullLabel, SerializedProperty atlas, UnityAction onSelect = null) 128 | { 129 | DrawAtlasPopup(rect, label, nullLabel, atlas.objectReferenceValue as SpriteAtlas, obj => 130 | { 131 | atlas.objectReferenceValue = obj; 132 | if (onSelect != null) 133 | onSelect(obj as SpriteAtlas); 134 | atlas.serializedObject.ApplyModifiedProperties(); 135 | }); 136 | } 137 | 138 | public static void DrawAtlasPopup(Rect rect, GUIContent label, GUIContent nullLabel, SpriteAtlas atlas, UnityAction onSelect = null) 139 | { 140 | rect = EditorGUI.PrefixLabel(rect, label); 141 | var gm = new GenericMenu(); 142 | if (GUI.Button(rect, atlas ? new GUIContent(atlas.name) : nullLabel, EditorStyles.popup)) 143 | { 144 | gm.AddItem(nullLabel, !atlas, () => onSelect(null)); 145 | 146 | foreach (string path in AssetDatabase.FindAssets("t:" + typeof(SpriteAtlas).Name).Select(x => AssetDatabase.GUIDToAssetPath(x))) 147 | { 148 | string displayName = Path.GetFileNameWithoutExtension(path); 149 | gm.AddItem( 150 | new GUIContent(displayName), 151 | atlas && (atlas.name == displayName), 152 | x => onSelect(x == null ? null : AssetDatabase.LoadAssetAtPath((string) x, typeof(SpriteAtlas)) as SpriteAtlas), 153 | path 154 | ); 155 | } 156 | 157 | gm.DropDown(rect); 158 | } 159 | } 160 | 161 | public static void DrawSpritePopup(SpriteAtlas atlas, SerializedProperty spriteName) 162 | { 163 | DrawSpritePopup(new GUIContent(spriteName.displayName, spriteName.tooltip), atlas, spriteName); 164 | } 165 | 166 | public static void DrawSpritePopup(GUIContent label, SpriteAtlas atlas, SerializedProperty spriteName) 167 | { 168 | DrawSpritePopup( 169 | label, 170 | atlas, 171 | string.IsNullOrEmpty(spriteName.stringValue) ? "-" : spriteName.stringValue, 172 | name => 173 | { 174 | if (spriteName == null) 175 | return; 176 | 177 | spriteName.stringValue = name; 178 | spriteName.serializedObject.ApplyModifiedProperties(); 179 | } 180 | ); 181 | } 182 | 183 | public static void DrawSpritePopup(GUIContent label, SpriteAtlas atlas, string spriteName, UnityAction onChange) 184 | { 185 | var controlID = GUIUtility.GetControlID(FocusType.Passive); 186 | if (_openSelectorWindow) 187 | { 188 | var atlasLabel = SetAtlasLabelToSprites(atlas, true); 189 | EditorGUIUtility.ShowObjectPicker(atlas.GetSprite(spriteName), false, "l:" + atlasLabel, controlID); 190 | _openSelectorWindow = false; 191 | } 192 | 193 | // Popup-styled button to select sprite in atlas. 194 | using (new EditorGUI.DisabledGroupScope(!atlas)) 195 | using (new EditorGUILayout.HorizontalScope()) 196 | { 197 | EditorGUILayout.PrefixLabel(label); 198 | if (GUILayout.Button(string.IsNullOrEmpty(spriteName) ? "-" : spriteName, "minipopup") && atlas) 199 | { 200 | if (_lastSpriteAtlas != atlas) 201 | { 202 | _lastSpriteAtlas = atlas; 203 | PackAtlas(atlas); 204 | } 205 | 206 | _openSelectorWindow = true; 207 | } 208 | } 209 | 210 | if (controlID != EditorGUIUtility.GetObjectPickerControlID()) return; 211 | var commandName = Event.current.commandName; 212 | if (commandName == "ObjectSelectorUpdated") 213 | { 214 | Object picked = EditorGUIUtility.GetObjectPickerObject(); 215 | onChange(picked ? picked.name.Replace("(Clone)", "") : ""); 216 | } 217 | else if (commandName == "ObjectSelectorClosed") 218 | { 219 | // On close selector window, reomove the atlas label from sprites. 220 | SetAtlasLabelToSprites(atlas, false); 221 | } 222 | } 223 | 224 | private static string SetAtlasLabelToSprites(SpriteAtlas atlas, bool add) 225 | { 226 | string[] assetLabels = {AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(atlas))}; 227 | SerializedProperty spPackedSprites = new SerializedObject(atlas).FindProperty("m_PackedSprites"); 228 | Sprite[] sprites = Enumerable.Range(0, spPackedSprites.arraySize) 229 | .Select(index => spPackedSprites.GetArrayElementAtIndex(index).objectReferenceValue) 230 | .OfType() 231 | .ToArray(); 232 | 233 | foreach (var s in sprites) 234 | { 235 | string[] newLabels = add 236 | ? AssetDatabase.GetLabels(s).Union(assetLabels).ToArray() 237 | : AssetDatabase.GetLabels(s).Except(assetLabels).ToArray(); 238 | AssetDatabase.SetLabels(s, newLabels); 239 | } 240 | 241 | return assetLabels[0]; 242 | } 243 | 244 | private static void PackAtlas(SpriteAtlas atlas) 245 | { 246 | System.Type 247 | .GetType("UnityEditor.U2D.SpriteAtlasUtility, UnityEditor") 248 | .GetMethod("PackAtlases", BindingFlags.NonPublic | BindingFlags.Static) 249 | .Invoke(null, new object[] {new[] {atlas}, EditorUserBuildSettings.activeBuildTarget}); 250 | } 251 | 252 | private static Sprite GetOriginalSprite(SpriteAtlas atlas, string name) 253 | { 254 | if (!atlas || string.IsNullOrEmpty(name)) 255 | { 256 | return null; 257 | } 258 | 259 | SerializedProperty spPackedSprites = new SerializedObject(atlas).FindProperty("m_PackedSprites"); 260 | return Enumerable.Range(0, spPackedSprites.arraySize) 261 | .Select(index => spPackedSprites.GetArrayElementAtIndex(index).objectReferenceValue) 262 | .OfType() 263 | .FirstOrDefault(s => s.name == name); 264 | } 265 | 266 | 267 | //%%%% v Context menu for editor v %%%% 268 | [MenuItem("CONTEXT/Image/Convert To AtlasImage", true)] 269 | static bool _ConvertToAtlasImage(MenuCommand command) 270 | { 271 | return CanConvertTo(command.context); 272 | } 273 | 274 | [MenuItem("CONTEXT/Image/Convert To AtlasImage", false)] 275 | static void ConvertToAtlasImage(MenuCommand command) 276 | { 277 | ConvertTo(command.context); 278 | } 279 | 280 | [MenuItem("CONTEXT/Image/Convert To Image", true)] 281 | static bool _ConvertToImage(MenuCommand command) 282 | { 283 | return CanConvertTo(command.context); 284 | } 285 | 286 | [MenuItem("CONTEXT/Image/Convert To Image", false)] 287 | static void ConvertToImage(MenuCommand command) 288 | { 289 | ConvertTo(command.context); 290 | } 291 | 292 | /// 293 | /// Verify whether it can be converted to the specified component. 294 | /// 295 | protected static bool CanConvertTo(Object context) 296 | where T : MonoBehaviour 297 | { 298 | return context && context.GetType() != typeof(T); 299 | } 300 | 301 | /// 302 | /// Convert to the specified component. 303 | /// 304 | protected static void ConvertTo(Object context) where T : MonoBehaviour 305 | { 306 | var target = context as MonoBehaviour; 307 | var so = new SerializedObject(target); 308 | so.Update(); 309 | 310 | bool oldEnable = target.enabled; 311 | target.enabled = false; 312 | 313 | // Find MonoScript of the specified component. 314 | foreach (var script in Resources.FindObjectsOfTypeAll()) 315 | { 316 | if (script.GetClass() != typeof(T)) 317 | continue; 318 | 319 | // Set 'm_Script' to convert. 320 | so.FindProperty("m_Script").objectReferenceValue = script; 321 | so.ApplyModifiedProperties(); 322 | break; 323 | } 324 | 325 | (so.targetObject as MonoBehaviour).enabled = oldEnable; 326 | } 327 | } 328 | } 329 | -------------------------------------------------------------------------------- /Editor/AtlasImageEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 419fc3c4a02fd408880059fcc34cb15a 3 | timeCreated: 1524794519 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Coffee.AtlasImage.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Coffee.AtlasImage.Editor", 3 | "references": [ 4 | "Coffee.AtlasImage" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [] 16 | } -------------------------------------------------------------------------------- /Editor/Coffee.AtlasImage.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f71656cf208dc4cdba51ef27b31be4e2 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/ImportSampleMenu.cs: -------------------------------------------------------------------------------- 1 | #if !UNITY_2019_1_OR_NEWER 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using UnityEditor; 6 | 7 | namespace Coffee.UIExtensions 8 | { 9 | internal static class ImportSampleMenu_UIAtlasImage 10 | { 11 | private const string k_DisplayName = "UI Atlas Image"; 12 | private const string k_JsonGuid = "b9ea23bb827354bfaacf881970614a86"; 13 | 14 | [MenuItem("Assets/Samples/" + k_DisplayName + "/Demo")] 15 | private static void ImportSample() 16 | { 17 | ImportSample(k_JsonGuid, "Demo"); 18 | } 19 | 20 | private static void ImportSample(string jsonGuid, string sampleName) 21 | { 22 | var jsonPath = AssetDatabase.GUIDToAssetPath(jsonGuid); 23 | var packageRoot = Path.GetDirectoryName(jsonPath).Replace('\\', '/'); 24 | var json = File.ReadAllText(jsonPath); 25 | var version = Regex.Match(json, "\"version\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value; 26 | var src = string.Format("{0}/Samples~/{1}", packageRoot, sampleName); 27 | var dst = string.Format("Assets/Samples/{0}/{1}/{2}", k_DisplayName, version, sampleName); 28 | var previousPath = GetPreviousSamplePath(k_DisplayName, sampleName); 29 | 30 | // Remove the previous sample directory. 31 | if (!string.IsNullOrEmpty(previousPath)) 32 | { 33 | var msg = "A different version of the sample is already imported at\n\n" 34 | + previousPath 35 | + "\n\nIt will be deleted when you update. Are you sure you want to continue?"; 36 | if (!EditorUtility.DisplayDialog("Sample Importer", msg, "OK", "Cancel")) 37 | return; 38 | 39 | FileUtil.DeleteFileOrDirectory(previousPath); 40 | 41 | var metaFile = previousPath + ".meta"; 42 | if (File.Exists(metaFile)) 43 | FileUtil.DeleteFileOrDirectory(metaFile); 44 | } 45 | 46 | if (!Directory.Exists(dst)) 47 | FileUtil.DeleteFileOrDirectory(dst); 48 | 49 | var dstDir = Path.GetDirectoryName(dst); 50 | if (!Directory.Exists(dstDir)) 51 | Directory.CreateDirectory(dstDir); 52 | 53 | if (Directory.Exists(src)) 54 | FileUtil.CopyFileOrDirectory(src, dst); 55 | else 56 | throw new DirectoryNotFoundException(src); 57 | 58 | AssetDatabase.Refresh(ImportAssetOptions.ImportRecursive); 59 | } 60 | 61 | private static string GetPreviousSamplePath(string displayName, string sampleName) 62 | { 63 | var sampleRoot = string.Format("Assets/Samples/{0}", displayName); 64 | var sampleRootInfo = new DirectoryInfo(sampleRoot); 65 | if (!sampleRootInfo.Exists) return null; 66 | 67 | return sampleRootInfo.GetDirectories() 68 | .Select(versionDir => Path.Combine(versionDir.ToString(), sampleName)) 69 | .FirstOrDefault(Directory.Exists); 70 | } 71 | } 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /Editor/ImportSampleMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b0861ee83e374ef98bdaa4eb468a6eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/SpritePreview.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Reflection; 4 | 5 | namespace CoffeeEditor.UIExtensions 6 | { 7 | internal class SpritePreview 8 | { 9 | public Color color = Color.white; 10 | 11 | Vector4 m_Border; 12 | 13 | bool m_EnableBorderEdit = false; 14 | 15 | public Sprite sprite 16 | { 17 | get { return m_Sprite; } 18 | set 19 | { 20 | if (m_Sprite != value) 21 | { 22 | m_Sprite = value; 23 | m_Border = m_Sprite ? m_Sprite.border : Vector4.zero; 24 | } 25 | } 26 | } 27 | 28 | public System.Action onApplyBorder; 29 | 30 | Sprite m_Sprite; 31 | 32 | MethodInfo miDrawSprite = System.Type.GetType("UnityEditor.UI.SpriteDrawUtility, UnityEditor.UI") 33 | .GetMethod("DrawSprite", 34 | BindingFlags.NonPublic | BindingFlags.Static, 35 | null, 36 | new System.Type[] {typeof(Texture), typeof(Rect), typeof(Vector4), typeof(Rect), typeof(Rect), typeof(Rect), typeof(Color), typeof(Material)}, 37 | null 38 | ); 39 | 40 | public GUIContent GetPreviewTitle() 41 | { 42 | return new GUIContent(sprite ? sprite.name : "-"); 43 | } 44 | 45 | /// 46 | /// Displays a sprite with a border. 47 | /// This method is almost equivalent to UnityEditor.UI.SpriteDrawUtility. 48 | /// For more information, decompile UnityEditor.UI.SpriteDrawUtility. 49 | /// 50 | private void DrawSprite(Rect drawArea, Vector4 border) 51 | { 52 | if (sprite == null) 53 | return; 54 | 55 | var tex = sprite.texture; 56 | if (tex == null) 57 | return; 58 | 59 | var outer = sprite.rect; 60 | var inner = outer; 61 | inner.xMin += border.x; 62 | inner.yMin += border.y; 63 | inner.xMax -= border.z; 64 | inner.yMax -= border.w; 65 | 66 | var uv4 = UnityEngine.Sprites.DataUtility.GetOuterUV(sprite); 67 | var uv = new Rect(uv4.x, uv4.y, uv4.z - uv4.x, uv4.w - uv4.y); 68 | var padding = UnityEngine.Sprites.DataUtility.GetPadding(sprite); 69 | padding.x /= outer.width; 70 | padding.y /= outer.height; 71 | padding.z /= outer.width; 72 | padding.w /= outer.height; 73 | 74 | miDrawSprite.Invoke(null, new object[] {tex, drawArea, padding, outer, inner, uv, color, null}); 75 | } 76 | 77 | /// 78 | /// Displays an interactive sprite preview. 79 | /// 80 | public void OnPreviewGUI(Rect rect) 81 | { 82 | DrawSprite(rect, m_Border); 83 | DrawBorderEditWindow(rect); 84 | } 85 | 86 | /// 87 | /// Draws a border editing window. 88 | /// 89 | private void DrawBorderEditWindow(Rect rect) 90 | { 91 | if (!m_EnableBorderEdit) 92 | return; 93 | 94 | // Draw background 95 | var boxRect = new Rect(rect.x + rect.width - 70, rect.y - 3, 70, 80); 96 | GUI.Box(boxRect, "", "helpbox"); 97 | 98 | // Draw border 99 | var labelWidth = EditorGUIUtility.labelWidth; 100 | var fontSize = EditorStyles.label.fontSize; 101 | { 102 | EditorGUIUtility.labelWidth = 40; 103 | EditorStyles.label.fontSize = 9; 104 | Rect elementRect = new Rect(boxRect.x + 2, boxRect.y + 3, boxRect.width - 6, 14); 105 | 106 | //ボーダーを編集. 107 | elementRect = MiniIntField(elementRect, "Left", ref m_Border.x); 108 | elementRect = MiniIntField(elementRect, "Right", ref m_Border.z); 109 | elementRect = MiniIntField(elementRect, "Top", ref m_Border.w); 110 | elementRect = MiniIntField(elementRect, "Bottom", ref m_Border.y); 111 | 112 | //ボーダーを適用. 113 | if (GUI.Button(elementRect, "Apply", "minibutton")) 114 | { 115 | m_EnableBorderEdit = false; 116 | ApplyBorder(); 117 | } 118 | } 119 | EditorStyles.label.fontSize = fontSize; 120 | EditorGUIUtility.labelWidth = labelWidth; 121 | } 122 | 123 | private static Rect MiniIntField(Rect rect, string label, ref float value) 124 | { 125 | value = Mathf.Max(0, EditorGUI.IntField(rect, label, (int) value, EditorStyles.miniTextField)); 126 | rect.y += rect.height + 1; 127 | return rect; 128 | } 129 | 130 | /// 131 | /// Apply the border settings to sprite. 132 | /// 133 | private void ApplyBorder() 134 | { 135 | var isDirty = false; 136 | var t = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(m_Sprite)) as TextureImporter; 137 | 138 | switch (t.spriteImportMode) 139 | { 140 | case SpriteImportMode.Single: 141 | t.spriteBorder = m_Border; 142 | isDirty = true; 143 | break; 144 | case SpriteImportMode.Multiple: 145 | var spritesheet = t.spritesheet; 146 | for (var i = 0; i < spritesheet.Length; i++) 147 | { 148 | if (spritesheet[i].name != m_Sprite.name) continue; 149 | 150 | spritesheet[i].border = m_Border; 151 | isDirty = true; 152 | } 153 | 154 | t.spritesheet = spritesheet; 155 | break; 156 | } 157 | 158 | if (!isDirty) return; 159 | 160 | EditorUtility.SetDirty(t); 161 | t.SaveAndReimport(); 162 | 163 | if (onApplyBorder != null) 164 | { 165 | onApplyBorder(); 166 | } 167 | } 168 | 169 | public string GetInfoString() 170 | { 171 | return m_Sprite ? string.Format("{0} : {1}x{2}", m_Sprite.name, Mathf.RoundToInt(m_Sprite.rect.width), Mathf.RoundToInt(m_Sprite.rect.height)) : ""; 172 | } 173 | 174 | public void OnPreviewSettings() 175 | { 176 | m_EnableBorderEdit = GUILayout.Toggle(m_EnableBorderEdit, "Border", "PreButton"); 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /Editor/SpritePreview.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 556179c88265b4dda8c2c1c10dbbbec2 3 | timeCreated: 1524794519 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 mob-sakai 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. -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8405eba7f1454d40ba752f043b84921 3 | timeCreated: 1524986000 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Atlas Image 2 | === 3 | 4 | A graphic component use `SpriteAtlas` for uGUI. 5 | In addition, add useful **sprite picker** and **border editor** to the inspector. 6 | 7 | ![image](https://user-images.githubusercontent.com/12690315/39434547-d5f34956-4cd3-11e8-82b1-f7f2f7be953a.png) 8 | 9 | [![](https://img.shields.io/npm/v/com.coffee.atlas-image?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.coffee.atlas-image/) 10 | [![](https://img.shields.io/github/v/release/mob-sakai/AtlasImage?include_prereleases)](https://github.com/mob-sakai/AtlasImage/releases) 11 | [![](https://img.shields.io/github/release-date/mob-sakai/AtlasImage.svg)](https://github.com/mob-sakai/AtlasImage/releases) [![](https://img.shields.io/github/license/mob-sakai/AtlasImage.svg)](https://github.com/mob-sakai/AtlasImage/blob/main/LICENSE) 12 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-orange.svg)](http://makeapullrequest.com) 13 | ![](https://img.shields.io/badge/Unity%202017.1+-supported-blue.svg) 14 | 15 | << [Description](#Description) | [Demo](#demo) | [Installation](#installation) | [Usage](#usage) | [Development Note](#development-note) | [Change log](https://github.com/mob-sakai/AtlasImage/blob/main/CHANGELOG.md) >> 16 | 17 | 18 | 19 |



20 | 21 | ## Description 22 | 23 | Are you still fatigued with `SpriteAtlas` and `Image`? 24 | * No interface for SpriteAtlas 25 | * Support only `Sprite`. 26 | * We pack sprites for drawing call optimization, but there is no interface. 27 | * Confusing sprite picker 28 | * You can select sprites using object picker. 29 | * Opject picker displays **all sprites in the project**... 30 | * Do you know which sprite is included in atlas? 31 | * Troublesome border setting 32 | * You can edit sprite border using sprite editor. 33 | * It is troublesome to select a sprite, open a sprite editor, and edit the border. 34 | 35 | 36 | `AtlasImage` provides useful feature to use `SpriteAtlas` for UI! 37 | 38 | ### Sprite for renderring can be changed with a SpriteAtlas or a sprite name. 39 | 40 | ```cs 41 | atlasImage.spriteAtlas = Resources.Load("A SpriteAtlas name") as SpriteAtlas; 42 | atlasImage.spriteName = "A sprite name in the SpriteAtlas"; 43 | ``` 44 | 45 | ### In the inspector, sprite picker displays only sprites in the SpriteAtlas. 46 | 47 | ![image](https://user-images.githubusercontent.com/12690315/39434547-d5f34956-4cd3-11e8-82b1-f7f2f7be953a.png) 48 | 49 | 50 | ### You can edit the border in the preview window. 51 | 52 | ![image](https://user-images.githubusercontent.com/12690315/39434440-869e54ea-4cd3-11e8-9506-cdf0b62207ac.png) 53 | 54 | ### Convert `Image` to `AtlasImage` by context menu. 55 | 56 | 57 | 58 |



59 | 60 | ## Demo 61 | 62 | 63 | 64 |



65 | 66 | ## Installation 67 | 68 | ### Requirement 69 | 70 | * Unity 2017.1 or later 71 | 72 | ### (For Unity 2018.3 or later) Using OpenUPM 73 | 74 | This package is available on [OpenUPM](https://openupm.com). 75 | You can install it via [openupm-cli](https://github.com/openupm/openupm-cli). 76 | ``` 77 | openupm add com.coffee.atlas-image 78 | ``` 79 | 80 | ### (For Unity 2018.3 or later) Using Git 81 | 82 | Find the manifest.json file in the Packages folder of your project and add a line to `dependencies` field. 83 | 84 | * Major version: ![](https://img.shields.io/github/v/release/mob-sakai/AtlasImage) 85 | `"com.coffee.atlas-image": "https://github.com/mob-sakai/AtlasImage.git"` 86 | 87 | To update the package, change suffix `#{version}` to the target version. 88 | 89 | * e.g. `"com.coffee.atlas-image": "https://github.com/mob-sakai/AtlasImage.git#1.0.0",` 90 | 91 | Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to install and update the package. 92 | 93 | #### For Unity 2018.2 or earlier 94 | 95 | 1. Download a source code zip file from [Releases](https://github.com/mob-sakai/AtlasImage/releases) page 96 | 2. Extract it 97 | 3. Import it into the following directory in your Unity project 98 | - `Packages` (It works as an embedded package. For Unity 2018.1 or later) 99 | - `Assets` (Legacy way. For Unity 2017.1 or later) 100 | 101 | 102 | 103 |



104 | 105 | ## Usage 106 | 107 | 1. Enable SpriteAtlas. Go to `Edit > Project Settings > Editor`, and change the sprite packing mode from Disabled to either: 108 | * Enabled for Builds, when you want to use packing for builds only and not when in Play mode. 109 | * Always Enabled when you want the packed Sprite to resolve its texture from the Sprite Atlas during Play mode, but resolve its texture from the original Texture during Edit mode. 110 | 1. Add `AtlasImage` component instead of `Image` component from `Add Component` in inspector. 111 | 1. Select the `SpriteAtlas` by dropdown manu, and select the sprite with object piker. 112 | 1. Enjoy! 113 | 114 | 115 | 116 |



117 | 118 | ## Development Note 119 | 120 | ### How to work? 121 | 122 | 1. Pack atlas on open select sprite window. 123 | ```cs 124 | static void PackAtlas(SpriteAtlas atlas) 125 | { 126 | System.Type 127 | .GetType("UnityEditor.U2D.SpriteAtlasUtility, UnityEditor") 128 | .GetMethod("PackAtlases", BindingFlags.NonPublic | BindingFlags.Static) 129 | .Invoke(null, new object[]{ new []{ atlas }, EditorUserBuildSettings.activeBuildTarget }); 130 | } 131 | ``` 132 | 1. Add label `` to sprites in atlas. 133 | ```cs 134 | static string SetAtlasLabelToSprites(SpriteAtlas atlas, bool add) 135 | { 136 | // GUID for the atlas. 137 | string[] atlasLabel = { AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(atlas)) }; 138 | 139 | // Packed sprites in atlas. 140 | SerializedProperty spPackedSprites = new SerializedObject(atlas).FindProperty("m_PackedSprites"); 141 | Sprite[] sprites = Enumerable.Range(0, spPackedSprites.arraySize) 142 | .Select(index => spPackedSprites.GetArrayElementAtIndex(index).objectReferenceValue) 143 | .OfType() 144 | .ToArray(); 145 | 146 | // Add/remove label to sprites. 147 | foreach (var s in sprites) 148 | { 149 | string[] newLabels = add 150 | ? AssetDatabase.GetLabels(s).Union(atlasLabel).ToArray() 151 | : AssetDatabase.GetLabels(s).Except(atlasLabel).ToArray(); 152 | AssetDatabase.SetLabels(s, newLabels); 153 | } 154 | 155 | return atlasLabel[0]; 156 | } 157 | ``` 158 | 1. Open the object picker with label. It filter the sprites to display. 159 | ```cs 160 | EditorGUIUtility.ShowObjectPicker(atlas.GetSprite(spriteName), false, "l:" + atlasLabel, controlID); 161 | ``` 162 | 1. On closed the object picker, remove label from sprites in atlas. 163 | 164 | 165 | 166 |



167 | 168 | ## Contributing 169 | 170 | ### Issues 171 | 172 | Issues are very valuable to this project. 173 | 174 | - Ideas are a valuable source of contributions others can make 175 | - Problems show where this project is lacking 176 | - With a question you show where contributors can improve the user experience 177 | 178 | ### Pull Requests 179 | 180 | Pull requests are, a great way to get your ideas into this repository. 181 | See [sandbox/README.md](https://github.com/mob-sakai/AtlasImage/blob/sandbox/README.md). 182 | 183 | ### Support 184 | 185 | This is an open source project that I am developing in my spare time. 186 | If you like it, please support me. 187 | With your support, I can spend more time on development. :) 188 | 189 | [![](https://user-images.githubusercontent.com/12690315/50731629-3b18b480-11ad-11e9-8fad-4b13f27969c1.png)](https://www.patreon.com/join/mob_sakai?) 190 | [![](https://user-images.githubusercontent.com/12690315/66942881-03686280-f085-11e9-9586-fc0b6011029f.png)](https://github.com/users/mob-sakai/sponsorship) 191 | 192 | 193 | 194 |



195 | 196 | ## License 197 | 198 | * MIT 199 | 200 | 201 | 202 | ## Author 203 | 204 | * ![](https://user-images.githubusercontent.com/12690315/96986908-434a0b80-155d-11eb-8275-85138ab90afa.png) [mob-sakai](https://github.com/mob-sakai) [![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) ![GitHub followers](https://img.shields.io/github/followers/mob-sakai?style=social) 205 | 206 | 207 | 208 | ## See Also 209 | 210 | * GitHub page : https://github.com/mob-sakai/AtlasImage 211 | * Releases : https://github.com/mob-sakai/AtlasImage/releases 212 | * Issue tracker : https://github.com/mob-sakai/AtlasImage/issues 213 | * Change log : https://github.com/mob-sakai/AtlasImage/blob/main/CHANGELOG.md 214 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53320b23edd314919890d2d43f851458 3 | timeCreated: 1524986000 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Demo_AtlasImage", 3 | "references": [ 4 | "Coffee.AtlasImage" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f460f69455c3440fc9851395c1bfea20 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Coffee.UIExtensions.Demo 4 | { 5 | public class Demo_AtlasImage : MonoBehaviour 6 | { 7 | [SerializeField] private AtlasImage atlasImage; 8 | 9 | public void ChangeSpriteName(string spriteName) 10 | { 11 | if (!atlasImage) 12 | { 13 | return; 14 | } 15 | 16 | atlasImage.spriteName = spriteName; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 607a382507e07438794c13c1bd2c3347 3 | timeCreated: 1525099545 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.spriteatlas: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!687078895 &4343727234628468602 4 | SpriteAtlas: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: Demo_AtlasImage 10 | m_EditorData: 11 | serializedVersion: 2 12 | textureSettings: 13 | serializedVersion: 2 14 | anisoLevel: 1 15 | compressionQuality: 50 16 | maxTextureSize: 2048 17 | textureCompression: 0 18 | filterMode: 1 19 | generateMipMaps: 0 20 | readable: 0 21 | crunchedCompression: 0 22 | sRGB: 0 23 | platformSettings: 24 | - serializedVersion: 2 25 | m_BuildTarget: DefaultTexturePlatform 26 | m_MaxTextureSize: 2048 27 | m_ResizeAlgorithm: 0 28 | m_TextureFormat: -1 29 | m_TextureCompression: 0 30 | m_CompressionQuality: 50 31 | m_CrunchedCompression: 0 32 | m_AllowsAlphaSplitting: 0 33 | m_Overridden: 0 34 | m_AndroidETC2FallbackOverride: 0 35 | - serializedVersion: 2 36 | m_BuildTarget: Android 37 | m_MaxTextureSize: 2048 38 | m_ResizeAlgorithm: 0 39 | m_TextureFormat: 7 40 | m_TextureCompression: 1 41 | m_CompressionQuality: 50 42 | m_CrunchedCompression: 0 43 | m_AllowsAlphaSplitting: 0 44 | m_Overridden: 0 45 | m_AndroidETC2FallbackOverride: 0 46 | packingSettings: 47 | serializedVersion: 2 48 | padding: 4 49 | blockOffset: 1 50 | allowAlphaSplitting: 0 51 | enableRotation: 1 52 | enableTightPacking: 1 53 | variantMultiplier: 1 54 | packables: 55 | - {fileID: 102900000, guid: 21fadf77d8f4d4aa786fb9b66a7f98bf, type: 3} 56 | totalSpriteSurfaceArea: 6658 57 | bindAsDefault: 1 58 | m_MasterAtlas: {fileID: 0} 59 | m_PackedSprites: 60 | - {fileID: 21300000, guid: 9d64c4c1d47f24d59b6f3a3ae3a8b1bd, type: 3} 61 | - {fileID: 21300000, guid: fbd451d1fc5b14ff1bb3cb8d68b1accc, type: 3} 62 | - {fileID: 21300000, guid: 4b77baf2f77ed4395b64b8a3ad08042d, type: 3} 63 | - {fileID: 21300000, guid: 5cfbb4286339c4f4aa41b0e8454f8a10, type: 3} 64 | - {fileID: 21300000, guid: 9cae1dd8a36cc4c1388571dd6c120388, type: 3} 65 | - {fileID: 21300000, guid: 371ba969ca5aa42fda5e6ecfa72429d2, type: 3} 66 | - {fileID: 21300000, guid: 7bc81ef95e0e4465280d9ed72572af90, type: 3} 67 | - {fileID: 21300000, guid: 8cda6dcdc399d45349a202b8ba499929, type: 3} 68 | - {fileID: 21300000, guid: 419ef4ceb4d34455db31e4c0223c1109, type: 3} 69 | - {fileID: 21300000, guid: 34b5c9ffa3c324c8ab4b8f499e50fbe9, type: 3} 70 | m_PackedSpriteNamesToIndex: 71 | - ammo-6 72 | - health-bar 73 | - health-bar-box 74 | - ammo-5 75 | - box 76 | - ammo-3 77 | - ammo-2 78 | - cursor 79 | - ammo-1 80 | - ammo-4 81 | m_Tag: Demo_AtlasImage 82 | m_IsVariant: 0 83 | -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.spriteatlas.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcde36009844d4df1a94b238312a80ab 3 | timeCreated: 1524795837 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 4343727234628468602 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Samples~/Demo/Demo_AtlasImage.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26398f8e4fc05448795fd111af82c103 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21fadf77d8f4d4aa786fb9b66a7f98bf 3 | folderAsset: yes 4 | timeCreated: 1524795751 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/ammo-1.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 419ef4ceb4d34455db31e4c0223c1109 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 1601325e2cd3a44d9a9893cb86fd2314 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/ammo-2.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bc81ef95e0e4465280d9ed72572af90 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 4, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 59de67a2eb5c54110a13d050411b8579 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/ammo-3.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-3.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 371ba969ca5aa42fda5e6ecfa72429d2 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 2, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 6cfd18a4985184e3eb03f9cb3816af76 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/ammo-4.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-4.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34b5c9ffa3c324c8ab4b8f499e50fbe9 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 9d290154ded1a4b8b954859badde97b3 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/ammo-5.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-5.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5cfbb4286339c4f4aa41b0e8454f8a10 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 5aaee9f6930ea4d9eb061d50ab525875 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/ammo-6.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/ammo-6.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d64c4c1d47f24d59b6f3a3ae3a8b1bd 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 705eafe25a77a4566bbd20f15c5e723b 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/box.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/box.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cae1dd8a36cc4c1388571dd6c120388 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 15, y: 13, z: 12, w: 16} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: eb5dffb7369894a47aa7675b480519bd 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/cursor.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/cursor.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cda6dcdc399d45349a202b8ba499929 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 2cfaf27e1b7874b6a852151d61dca476 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/health-bar-box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/health-bar-box.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/health-bar-box.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b77baf2f77ed4395b64b8a3ad08042d 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 12, y: 6, z: 11, w: 5} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 2d6a7492ca5a44e58b8839136f8adeed 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/health-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/AtlasImage/82052cb4081f5a66fb9758bb0ae36ad57910a4a2/Samples~/Demo/Sprites/health-bar.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprites/health-bar.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbd451d1fc5b14ff1bb3cb8d68b1accc 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 2, y: 2, z: 2, w: 2} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 2048 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | - serializedVersion: 2 84 | buildTarget: iPhone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | androidETC2FallbackOverride: 0 94 | - serializedVersion: 2 95 | buildTarget: Android 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | - serializedVersion: 2 106 | buildTarget: WebGL 107 | maxTextureSize: 2048 108 | resizeAlgorithm: 0 109 | textureFormat: -1 110 | textureCompression: 1 111 | compressionQuality: 50 112 | crunchedCompression: 0 113 | allowsAlphaSplitting: 0 114 | overridden: 0 115 | androidETC2FallbackOverride: 0 116 | spriteSheet: 117 | serializedVersion: 2 118 | sprites: [] 119 | outline: [] 120 | physicsShape: [] 121 | bones: [] 122 | spriteID: 98a5406515f1f4dcbb5105f40709c18c 123 | vertices: [] 124 | indices: 125 | edges: [] 126 | weights: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.coffee.atlas-image", 3 | "displayName": "UI Atlas Image", 4 | "description": "A graphic component use SpriteAtlas for uGUI.\nIn addition, add useful sprite selector and border editor to the inspector.", 5 | "version": "1.0.0", 6 | "unity": "2017.1", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/mob-sakai/AtlasImage.git" 11 | }, 12 | "author": "mob-sakai (https://github.com/mob-sakai)", 13 | "keywords": [ 14 | "ui" 15 | ], 16 | "dependencies": {}, 17 | "samples": [ 18 | { 19 | "displayName": "Demo", 20 | "description": "UI Atlas Image Demo", 21 | "path": "Samples~/Demo" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9ea23bb827354bfaacf881970614a86 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------