- Home /
The question is answered, right answer was accepted
where are the icons for Gizmos.DrawIcon?
which icons are available for Gizmos.DrawIcon / where are they located?
Here's a really simple script I wrote to make this super easy to add custom icons to objects in the editor. All you have to do is attach this script to the object you want to have an icon drawn for. Then you need to make a new folder within the Assets folder called Gizmos. Put your textures you want to use as icons in this folder for this to work. Now you can just drag the icon you want from the Gizmos folder onto the script in the inspector, and it should appear right away. Let me know if this works :)
using UnityEngine;
using System.Collections;
public class gizmo : $$anonymous$$onoBehaviour
{
public Texture2D icon;
void OnDrawGizmos()
{
if(icon)
Gizmos.DrawIcon(transform.position, icon.name, true);
}
}
Not sure why this question was closed... But wanted to add a great answer I found for Windows. http://eppz.eu/blog/unity-editor-icon-assets/ made a blog post on how to export all the icons. The top of the blog post links to script you can add to any unity project. The script adds a "Window/eppz/Icon" to the top menu bar. Once open, first press "get", then "save", then you'll have a bunch of icons in \Assets\Editor Default Resources\icons
https://gist.github.com/eppz/bf0e0316102169445007924ae572562e
Answer by skovacs1 · Oct 08, 2010 at 10:18 PM
As per the docs:
The icon's path can be found in the Assets/Gizmos folder or in the Unity.app/Contents/Resources folder.
This is kind of weird, i dont have this folder in the Unity Directory (on Windows). When I use the example code from the Script Reference (Light Gizmo), I just get a black box... I made the icons myself and just put them into the Assets folder of my project.
The docs are either assu$$anonymous$$g a Unix-based installation for Unity.app/Contents/Resources to exist or they are out-of-date. The Windows installation doesn't seem to have the files readily accessible that I can find, but likely has them built into some sort of resource file in Unity\Editor\Data\Resources. As per the first part of the docs, you would have to put them in Assets/Gizmos. This means that in the Windows installation at least, there are no icons available for use with Gizmos.DrawIcon by default as far as I can tell.
Unity.app would refer to the name of your application/Content/Resources for use with Resources.Load()
I'd add that the docs read, " The image file should be placed in the Assets/Gizmos folder." For me "should" needs to be replaced with "must" or "has to", etc.
Answer by agentsmith · Feb 16, 2012 at 07:23 AM
I'm using Windows 7 and it worked when I created a "Gizmos" folder inside the "Assets" folder ( "Assets\Gizmos\" ) and threw all the icon images in "Gizmos".
Answer by Veehmot · Feb 07, 2012 at 04:04 AM
You can't use built-in gizmos in code. A workaround is to set the gizmo for a script component. That gizmo will be set to whatever object attached to.
Answer by robertbeverly · Feb 18, 2011 at 11:03 PM
I'm using the OS X version, and found I need to create a Gizmos folder in the Assets directory (through the Unity interface). Then I can drop in any icons I want to use for gizmos and Unity will find them.
Follow this Question
Related Questions
Custom Gizmo.DrawIcon Images 1 Answer
How would I replicate Gizmos.DrawLine in-game? 1 Answer
Console error when trying to use gizmos? 2 Answers
Drawing a Range Icon in 3D Space 0 Answers
Unable to set a custom Gizmo icon "other" is missing 1 Answer