Skip to content

Instantly share code, notes, and snippets.

@UtMan88
Created December 26, 2016 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UtMan88/bf1364e0ea5fa70706dc9ac8ce2f143d to your computer and use it in GitHub Desktop.
Save UtMan88/bf1364e0ea5fa70706dc9ac8ce2f143d to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
/// <summary>
/// This was just a quick-and-dirty tool when inside the Unity Editor.
/// Need an Icon on something? Throw this on it, assign a texture (via URI string), done.
/// </summary>
public class GizmoIcon : MonoBehaviour {
public string IconFile;
void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, IconFile, true);
}
#if !UNITY_EDITOR
// If we're not in the editor, this module shouldn't exist.
void Awake () {
Destroy(this);
}
#endif
}
@UtMan88
Copy link
Author

UtMan88 commented Dec 11, 2017

In order to make a gizmo appear, the file has to be in Assets/Gizmos

https://docs.unity3d.com/ScriptReference/Gizmos.DrawIcon.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment