Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom icons to unity atoms assets #23

Closed
AdamRamberg opened this issue Mar 28, 2019 · 8 comments
Closed

Add custom icons to unity atoms assets #23

AdamRamberg opened this issue Mar 28, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@AdamRamberg
Copy link
Collaborator

Wouldn't this library be soooo much better with gizmos? :D

Investigate if it is possible to just use one image / icon and use it for all script icons in the inspector and all unity atom assets created (like the Post Processing Stack is doing - https://github.com/Unity-Technologies/PostProcessing)

@AdamRamberg AdamRamberg added the enhancement New feature or request label Mar 28, 2019
@jeffcampbellmakesgames
Copy link

I think I hear what you're saying, although I think there might be a bit of confusion between Gizmos which are intended for visual debugging and setup in the Scene View versus overriding the default ScriptableObject icon so that unity-atom assets are visually distinguished.

This is pretty easy to setup. Given the number of distinct ScriptableObject derived types it would probably help to create a table/spreadsheet of each of the types we want to assign an icon to. That way we can infer a semantic or general intent thats easily visualized for each one and then create/assign an icon for it.

@AdamRamberg AdamRamberg changed the title Add Gizmos to unity atoms Add custom icons to unity atoms assets Apr 15, 2019
@AdamRamberg
Copy link
Collaborator Author

Got you! Was a little bit lazy and didn't do enough research before making the issue (just wanted to create it to keep track of it). Changed the name of the issue sto make it less confusing.

A spreadsheet / table sounds like a good idea 👌My first initial thought is to create an icon per type, Variable, Event, Listeners, MonoHooks, Functions and Actions. How does that sound to you? Wouldn't mind if you start on a table.

Another suggestion would be to use the icon that I used for my blog post here (first picture). Then we could just change the color for each type. But again, would like some input on this.

@AdamRamberg
Copy link
Collaborator Author

AdamRamberg commented Jun 10, 2019

@jeffcampbellmakesgames How do you add custom icons to scripts / assets? From looking at your repo it seems like meta data is pointing to the guid of the icon. However, do you need to manually set this guid in the meta file(s) manually or is there some other way?

@jeffcampbellmakesgames
Copy link

You can either add that yaml section manually through the meta file or finding the script in the Unity Editor and manually assigning it through the inspector.

In the screenshot below, selecting the script's icon in the inspector and then selecting Other will allow you to manually select the icon to use.

image

@soraphis
Copy link
Collaborator

soraphis commented Jun 13, 2019

You can create a folder "Gizmos" and in there an image: <NameOfYourClass> Icon.png
(note the space between the class name and "Icon").

Assets of this class type should automatically use this icon

source

edit: reading further in this thread, it seems in newer versions you need to take the namespace into account, see this post: https://forum.unity.com/threads/custom-scriptableobject-icons-thumbnail.256246/#post-3654346

@jeffcampbellmakesgames
Copy link

You can create a folder "Gizmos" and in there an image: <NameOfYourClass> Icon.png
(note the space between the class name and "Icon").

Assets of this class type should automatically use this icon

source

edit: reading further in this thread, it seems in newer versions you need to take the namespace into account, see this post: https://forum.unity.com/threads/custom-scriptableobject-icons-thumbnail.256246/#post-3654346

Just to help clarify, Gizmos are for in-sceneview icons while the types of icons these would be for would be on the ScriptableObjects in the project view or wherever they are assigned as a serialized reference.

This reply goes into more detail.
#23 (comment)

@soraphis
Copy link
Collaborator

soraphis commented Jun 16, 2019

I opened the unity atoms project. Created a file at Assets/Gizmos/UnityAtoms/FloatVariable Icon.png

and as you can see in this image:

image

it obviosly works for assets created from scriptable objects. its not in the scene view, it does not have to be manually assigned


That said, you can't change the icon of a scriptable object asset like your picture shows. this only works for scripts. but doing a bit of research, and I think it should be clarified:

(since ~Unity 2017) if you assign an icon to the a script (like in your image shown) it will propagate this item to all instances of this script, and thus also to scriptable object assets of that scripts type.

@AdamRamberg
Copy link
Collaborator Author

Thanks @jeffcampbellmakesgames and @soraphis for the input!

Implemented a solution in cb6280a and bcdb8f1.

I actually ended up doing something a bit more complicated, but more robust when it comes to assigning icons to generated atoms (using the Generator.cs). I took some inspiration from this post on StackOverflow and did some adjustments to make it more flexible and general. It uses AssetPostprocessor to assign icons after assets are imported. Will probably break this out into its own repo, since I think that others could find it pretty nifty.

Think we are good for know if comes to the icons. Might come back to this later, but closing the issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants