{"id":13676035,"url":"https://github.com/mob-sakai/AtlasImage","last_synced_at":"2025-04-29T03:30:30.449Z","repository":{"id":65757156,"uuid":"131609948","full_name":"mob-sakai/AtlasImage","owner":"mob-sakai","description":" AtlasImage is a graphic component use SpriteAtlas for uGUI. In addition, add useful sprite selector and border editor to the inspector.","archived":false,"fork":false,"pushed_at":"2020-12-28T15:06:31.000Z","size":92,"stargazers_count":133,"open_issues_count":3,"forks_count":29,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-05T13:43:33.979Z","etag":null,"topics":["atlas","sprite","ugui","uguicomponent","unity","unity3d"],"latest_commit_sha":null,"homepage":"https://github.com/mob-sakai/AtlasImage","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mob-sakai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"mob-sakai","patreon":"mob_sakai","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-04-30T15:02:50.000Z","updated_at":"2025-02-28T23:05:27.000Z","dependencies_parsed_at":"2023-02-08T11:25:10.811Z","dependency_job_id":null,"html_url":"https://github.com/mob-sakai/AtlasImage","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FAtlasImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FAtlasImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FAtlasImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FAtlasImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mob-sakai","download_url":"https://codeload.github.com/mob-sakai/AtlasImage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251426691,"owners_count":21587633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atlas","sprite","ugui","uguicomponent","unity","unity3d"],"created_at":"2024-08-02T13:00:16.691Z","updated_at":"2025-04-29T03:30:29.971Z","avatar_url":"https://github.com/mob-sakai.png","language":"C#","funding_links":["https://github.com/sponsors/mob-sakai","https://patreon.com/mob_sakai","https://www.patreon.com/join/mob_sakai?"],"categories":["Open Source Repositories","Atlas","Open Source Packages"],"sub_categories":["2D"],"readme":"Atlas Image\n===\n\nA graphic component use `SpriteAtlas` for uGUI.  \nIn addition, add useful **sprite picker** and **border editor** to the inspector.\n\n![image](https://user-images.githubusercontent.com/12690315/39434547-d5f34956-4cd3-11e8-82b1-f7f2f7be953a.png)\n\n[![](https://img.shields.io/npm/v/com.coffee.atlas-image?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.coffee.atlas-image/)\n[![](https://img.shields.io/github/v/release/mob-sakai/AtlasImage?include_prereleases)](https://github.com/mob-sakai/AtlasImage/releases)\n[![](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)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-orange.svg)](http://makeapullrequest.com)  \n![](https://img.shields.io/badge/Unity%202017.1+-supported-blue.svg)  \n\n\u003c\u003c [Description](#Description) | [Demo](#demo) | [Installation](#installation) | [Usage](#usage) | [Development Note](#development-note) | [Change log](https://github.com/mob-sakai/AtlasImage/blob/main/CHANGELOG.md) \u003e\u003e\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Description\n\nAre you still fatigued with `SpriteAtlas` and `Image`?  \n* No interface for SpriteAtlas\n    * Support only `Sprite`.\n    * We pack sprites for drawing call optimization, but there is no interface.\n* Confusing sprite picker\n    * You can select sprites using object picker.  \n    * Opject picker displays **all sprites in the project**...  \n    * Do you know which sprite is included in atlas?\n* Troublesome border setting\n    * You can edit sprite border using sprite editor.\n    * It is troublesome to select a sprite, open a sprite editor, and edit the border.\n\n\n`AtlasImage` provides useful feature to use `SpriteAtlas` for UI!\n\n### Sprite for renderring can be changed with a SpriteAtlas or a sprite name.\n\n```cs\natlasImage.spriteAtlas = Resources.Load(\"A SpriteAtlas name\") as SpriteAtlas;\natlasImage.spriteName = \"A sprite name in the SpriteAtlas\";\n```\n\n### In the inspector, sprite picker displays only sprites in the SpriteAtlas.\n\n![image](https://user-images.githubusercontent.com/12690315/39434547-d5f34956-4cd3-11e8-82b1-f7f2f7be953a.png)\n\n\n### You can edit the border in the preview window.\n\n![image](https://user-images.githubusercontent.com/12690315/39434440-869e54ea-4cd3-11e8-9506-cdf0b62207ac.png)\n\n### Convert `Image` to `AtlasImage` by context menu.\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Demo\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Installation\n\n### Requirement\n\n* Unity 2017.1 or later\n\n### (For Unity 2018.3 or later) Using OpenUPM\n\nThis package is available on [OpenUPM](https://openupm.com).  \nYou can install it via [openupm-cli](https://github.com/openupm/openupm-cli).\n```\nopenupm add com.coffee.atlas-image\n```\n\n### (For Unity 2018.3 or later) Using Git\n\nFind the manifest.json file in the Packages folder of your project and add a line to `dependencies` field.\n\n* Major version: ![](https://img.shields.io/github/v/release/mob-sakai/AtlasImage)  \n`\"com.coffee.atlas-image\": \"https://github.com/mob-sakai/AtlasImage.git\"`\n\nTo update the package, change suffix `#{version}` to the target version.\n\n* e.g. `\"com.coffee.atlas-image\": \"https://github.com/mob-sakai/AtlasImage.git#1.0.0\",`\n\nOr, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to install and update the package.\n\n#### For Unity 2018.2 or earlier\n\n1. Download a source code zip file from [Releases](https://github.com/mob-sakai/AtlasImage/releases) page\n2. Extract it\n3. Import it into the following directory in your Unity project\n   - `Packages` (It works as an embedded package. For Unity 2018.1 or later)\n   - `Assets` (Legacy way. For Unity 2017.1 or later)\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Usage\n\n1. Enable SpriteAtlas. Go to `Edit \u003e Project Settings \u003e Editor`, and change the sprite packing mode from Disabled to either:\n    * Enabled for Builds, when you want to use packing for builds only and not when in Play mode.\n    * 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.\n1. Add `AtlasImage` component instead of `Image` component from `Add Component` in inspector.\n1. Select the `SpriteAtlas` by dropdown manu, and select the sprite with object piker.\n1. Enjoy!\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Development Note\n\n### How to work?\n\n1. Pack atlas on open select sprite window.\n```cs\nstatic void PackAtlas(SpriteAtlas atlas)\n{\n    System.Type\n        .GetType(\"UnityEditor.U2D.SpriteAtlasUtility, UnityEditor\")\n        .GetMethod(\"PackAtlases\", BindingFlags.NonPublic | BindingFlags.Static)\n        .Invoke(null, new object[]{ new []{ atlas }, EditorUserBuildSettings.activeBuildTarget });\n}\n```\n1. Add label `\u003catlas-guid\u003e` to sprites in atlas.\n```cs\nstatic string SetAtlasLabelToSprites(SpriteAtlas atlas, bool add)\n{\n    // GUID for the atlas. \n    string[] atlasLabel = { AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(atlas)) };\n\n    // Packed sprites in atlas.\n    SerializedProperty spPackedSprites = new SerializedObject(atlas).FindProperty(\"m_PackedSprites\");\n    Sprite[] sprites = Enumerable.Range(0, spPackedSprites.arraySize)\n        .Select(index =\u003e spPackedSprites.GetArrayElementAtIndex(index).objectReferenceValue)\n        .OfType\u003cSprite\u003e()\n        .ToArray();\n\n    // Add/remove label to sprites.\n    foreach (var s in sprites)\n    {\n        string[] newLabels = add\n            ? AssetDatabase.GetLabels(s).Union(atlasLabel).ToArray()\n            : AssetDatabase.GetLabels(s).Except(atlasLabel).ToArray();\n        AssetDatabase.SetLabels(s, newLabels);\n    }\n    \n    return atlasLabel[0];\n}\n```\n1. Open the object picker with label. It filter the sprites to display.\n```cs\nEditorGUIUtility.ShowObjectPicker\u003cSprite\u003e(atlas.GetSprite(spriteName), false, \"l:\" + atlasLabel, controlID);\n```\n1. On closed the object picker, remove label from sprites in atlas.\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Contributing\n\n### Issues\n\nIssues are very valuable to this project.\n\n- Ideas are a valuable source of contributions others can make\n- Problems show where this project is lacking\n- With a question you show where contributors can improve the user experience\n\n### Pull Requests\n\nPull requests are, a great way to get your ideas into this repository.  \nSee [sandbox/README.md](https://github.com/mob-sakai/AtlasImage/blob/sandbox/README.md).\n\n### Support\n\nThis is an open source project that I am developing in my spare time.  \nIf you like it, please support me.  \nWith your support, I can spend more time on development. :)\n\n[![](https://user-images.githubusercontent.com/12690315/50731629-3b18b480-11ad-11e9-8fad-4b13f27969c1.png)](https://www.patreon.com/join/mob_sakai?)  \n[![](https://user-images.githubusercontent.com/12690315/66942881-03686280-f085-11e9-9586-fc0b6011029f.png)](https://github.com/users/mob-sakai/sponsorship)\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## License\n\n* MIT\n\n\n\n## Author\n\n* ![](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\u0026style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) ![GitHub followers](https://img.shields.io/github/followers/mob-sakai?style=social)\n\n\n\n## See Also\n\n* GitHub page : https://github.com/mob-sakai/AtlasImage\n* Releases : https://github.com/mob-sakai/AtlasImage/releases\n* Issue tracker : https://github.com/mob-sakai/AtlasImage/issues\n* Change log : https://github.com/mob-sakai/AtlasImage/blob/main/CHANGELOG.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmob-sakai%2FAtlasImage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmob-sakai%2FAtlasImage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmob-sakai%2FAtlasImage/lists"}