GizmosUtility
GizmosUtility
provides functions to update icon, icon visibility and gizmos visibility.
Icon
With Type
// in a custom editor
[InitializeOnLoadMethod]
static void Init() {
// works for components and scriptables you can use directly GizmosUtility
GizmosUtility.SetIcon<ColorMatrix>("ColorMatrix_icon_component");
}
...
GizmosUtility.SetIcon(typeof(ColorMatrix), "ColorMatrix_icon_component");
GizmosUtility.GetIcon<ColorMatrix>();
GizmosUtility.GetIcon(typeof(ColorMatrix));
GizmosUtility.RemoveIcon<ColorMatrix>();
GizmosUtility.RemoveIcon(typeof(ColorMatrix));
GizmosUtility.SetIconVisibility<T>(false);
GizmosUtility.SetIconVisibility(obj.GetType(), false);
GizmosUtility.GetIconVisibility<T>();
GizmosUtility.GetIconVisibility(obj.GetType());
With instance
GizmosUtility.SetIcon(obj, "Texture_resource_name");
GizmosUtility.SetIcon(obj, TextureUtility.GetEmbeddedIcon("Texture_resource_name"));
GizmosUtility.GetIcon(obj);
Gizmos
With Type
GizmosUtility.SetGizmosVisibility<T>(false);
GizmosUtility.SetGizmosVisibility(obj.GetType(), false);
GizmosUtility.GetGizmosVisibility<T>();
GizmosUtility.GetGizmosVisibility(obj.GetType());
Mouse
GetWorldMousePosition
Get position hover the current drawing scene view
Vector3? pos = GizmosUtility.GetWorldMousePosition(new Plane(Vector3.up, Vector3.zero));