Created
December 26, 2016 22:59
-
-
Save UtMan88/bf1364e0ea5fa70706dc9ac8ce2f143d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to make a gizmo appear, the file has to be in Assets/Gizmos
https://docs.unity3d.com/ScriptReference/Gizmos.DrawIcon.html