All Projects → mob-sakai → Atlasimage

mob-sakai / Atlasimage

Licence: mit
AtlasImage is a graphic component use SpriteAtlas for uGUI. In addition, add useful sprite selector and border editor to the inspector.

Projects that are alternatives of or similar to Atlasimage

Bdframework.core
[中]Simple! Easy! Powerful Unity3d game workflow! Unity3d framework:c# hotfix(ILRuntime)、asset manager、ui workflow、network debug... and so on
Stars: ✭ 1,196 (+1376.54%)
Mutual labels:  unity, unity3d
Dlibfacelandmarkdetector
FaceLandmark Detector using Dlib (Unity Asset Plugin)
Stars: ✭ 80 (-1.23%)
Mutual labels:  unity, unity3d
Vfxgraphmodeling
Procedural modeling with Unity VFX Graph
Stars: ✭ 68 (-16.05%)
Mutual labels:  unity, unity3d
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+14341.98%)
Mutual labels:  unity, unity3d
Fancyscrollview
[Unity] A scrollview component that can implement highly flexible animations.
Stars: ✭ 1,216 (+1401.23%)
Mutual labels:  unity, unity3d
Akvj
Demo project for Akvfx (Azure Kinect plugin for Unity)
Stars: ✭ 79 (-2.47%)
Mutual labels:  unity, unity3d
4dviewstest
4DViews volumetric video + Unity
Stars: ✭ 71 (-12.35%)
Mutual labels:  unity, unity3d
Learning Unity Ecs 2
A bunch of small Unity projects where I explore and learn Unity's new ECS and Job System. Updated for the new API.
Stars: ✭ 65 (-19.75%)
Mutual labels:  unity, unity3d
Weaver
Weaver is a code weaving framework built right into Unity Engine. Based heavily off of Fody.
Stars: ✭ 78 (-3.7%)
Mutual labels:  unity, unity3d
Dkvfxsketches
VFX sketches with Depthkit and Unity
Stars: ✭ 74 (-8.64%)
Mutual labels:  unity, unity3d
Unimic
A wrapper for Unity's Microphone class.
Stars: ✭ 65 (-19.75%)
Mutual labels:  unity, unity3d
Unity3d Dynamicallyloadinganimation
👾 Unity3D Loading and unloading animations at runtime (Example)
Stars: ✭ 74 (-8.64%)
Mutual labels:  unity, unity3d
Sentry Unity
Sentry SDK for Unity3d
Stars: ✭ 66 (-18.52%)
Mutual labels:  unity, unity3d
3dxrayshader unity
Surface shader. Clips a Model with given plane , applies fresnel on clipped part and highlights the cross section.
Stars: ✭ 73 (-9.88%)
Mutual labels:  unity, unity3d
Drawmeshwithmotionvectors
An example showing how to generate per-object motion vectors when using DrawMesh.
Stars: ✭ 65 (-19.75%)
Mutual labels:  unity, unity3d
Extosc
extOSC is a tool dedicated to simplify creation of applications in Unity with OSC protocol usage.
Stars: ✭ 69 (-14.81%)
Mutual labels:  unity, unity3d
3 Modifiers And Abilities
Customise character abilities, weapons, characters and enemies. This includes multiple damage types, modifiers, sounds, animations. By the end you can create your core combat experience. (REF MA_RPG) http://gdev.tv/rpggithub
Stars: ✭ 64 (-20.99%)
Mutual labels:  unity, unity3d
09 Zombierunner Original
First person shooter with Unity terrain and AI pathfinding (http://gdev.tv/cudgithub)
Stars: ✭ 64 (-20.99%)
Mutual labels:  unity, unity3d
Nexplayer unity plugin
Stream videos in HLS & DASH with Widevine DRM using NexPlayer Video Streaming Player SDK for Unity on Android & iOS devices
Stars: ✭ 73 (-9.88%)
Mutual labels:  unity, unity3d
Davinci
An esay-to-use image downloading and caching library for Unity
Stars: ✭ 74 (-8.64%)
Mutual labels:  unity, unity3d

Atlas Image

A graphic component use SpriteAtlas for uGUI.
In addition, add useful sprite picker and border editor to the inspector.

image

PRs Welcome

<< Description | Demo | Installation | Usage | Development Note | Change log >>





Description

Are you still fatigued with SpriteAtlas and Image?

  • No interface for SpriteAtlas
    • Support only Sprite.
    • We pack sprites for drawing call optimization, but there is no interface.
  • Confusing sprite picker
    • You can select sprites using object picker.
    • Opject picker displays all sprites in the project...
    • Do you know which sprite is included in atlas?
  • Troublesome border setting
    • You can edit sprite border using sprite editor.
    • It is troublesome to select a sprite, open a sprite editor, and edit the border.

AtlasImage provides useful feature to use SpriteAtlas for UI!

Sprite for renderring can be changed with a SpriteAtlas or a sprite name.

atlasImage.spriteAtlas = Resources.Load("A SpriteAtlas name") as SpriteAtlas;
atlasImage.spriteName = "A sprite name in the SpriteAtlas";

In the inspector, sprite picker displays only sprites in the SpriteAtlas.

image

You can edit the border in the preview window.

image

Convert Image to AtlasImage by context menu.





Demo





Installation

Requirement

  • Unity 2017.1 or later

(For Unity 2018.3 or later) Using OpenUPM

This package is available on OpenUPM.
You can install it via openupm-cli.

openupm add com.coffee.atlas-image

(For Unity 2018.3 or later) Using Git

Find the manifest.json file in the Packages folder of your project and add a line to dependencies field.

  • Major version:
    "com.coffee.atlas-image": "https://github.com/mob-sakai/AtlasImage.git"

To update the package, change suffix #{version} to the target version.

  • e.g. "com.coffee.atlas-image": "https://github.com/mob-sakai/AtlasImage.git#1.0.0",

Or, use UpmGitExtension to install and update the package.

For Unity 2018.2 or earlier

  1. Download a source code zip file from Releases page
  2. Extract it
  3. Import it into the following directory in your Unity project
    • Packages (It works as an embedded package. For Unity 2018.1 or later)
    • Assets (Legacy way. For Unity 2017.1 or later)





Usage

  1. Enable SpriteAtlas. Go to Edit > Project Settings > Editor, and change the sprite packing mode from Disabled to either:
    • Enabled for Builds, when you want to use packing for builds only and not when in Play mode.
    • 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.
  2. Add AtlasImage component instead of Image component from Add Component in inspector.
  3. Select the SpriteAtlas by dropdown manu, and select the sprite with object piker.
  4. Enjoy!





Development Note

How to work?

  1. Pack atlas on open select sprite window.
static void PackAtlas(SpriteAtlas atlas)
{
    System.Type
        .GetType("UnityEditor.U2D.SpriteAtlasUtility, UnityEditor")
        .GetMethod("PackAtlases", BindingFlags.NonPublic | BindingFlags.Static)
        .Invoke(null, new object[]{ new []{ atlas }, EditorUserBuildSettings.activeBuildTarget });
}
  1. Add label <atlas-guid> to sprites in atlas.
static string SetAtlasLabelToSprites(SpriteAtlas atlas, bool add)
{
    // GUID for the atlas. 
    string[] atlasLabel = { AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(atlas)) };

    // Packed sprites in atlas.
    SerializedProperty spPackedSprites = new SerializedObject(atlas).FindProperty("m_PackedSprites");
    Sprite[] sprites = Enumerable.Range(0, spPackedSprites.arraySize)
        .Select(index => spPackedSprites.GetArrayElementAtIndex(index).objectReferenceValue)
        .OfType<Sprite>()
        .ToArray();

    // Add/remove label to sprites.
    foreach (var s in sprites)
    {
        string[] newLabels = add
            ? AssetDatabase.GetLabels(s).Union(atlasLabel).ToArray()
            : AssetDatabase.GetLabels(s).Except(atlasLabel).ToArray();
        AssetDatabase.SetLabels(s, newLabels);
    }
    
    return atlasLabel[0];
}
  1. Open the object picker with label. It filter the sprites to display.
EditorGUIUtility.ShowObjectPicker<Sprite>(atlas.GetSprite(spriteName), false, "l:" + atlasLabel, controlID);
  1. On closed the object picker, remove label from sprites in atlas.





Contributing

Issues

Issues are very valuable to this project.

  • Ideas are a valuable source of contributions others can make
  • Problems show where this project is lacking
  • With a question you show where contributors can improve the user experience

Pull Requests

Pull requests are, a great way to get your ideas into this repository.
See sandbox/README.md.

Support

This is an open source project that I am developing in my spare time.
If you like it, please support me.
With your support, I can spend more time on development. :)






License

  • MIT

Author

See Also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].