# GizmoUtility

> A static class for interacting with the Scene View icons and gizmos for types.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static class GizmoUtility
```

## Examples

```csharp
using System;
using UnityEditor;
using UnityEngine;

namespace UnityEditor.Gizmos.Tests
{
// An Editor Window that lets you edit the gizmo and icon properties for each selected component.
    public class GizmoUtilityExample : EditorWindow
    {
        [MenuItem("Window/Gizmo Window")]
        static void Init() => GetWindow<GizmoUtilityExample>();

        Vector2 m_Scroll;

        void OnEnable()
        {
            autoRepaintOnSceneChange = true;
        }

        void OnGUI()
        {
            GizmoUtility.use3dIcons = EditorGUILayout.Toggle("3D Icons", GizmoUtility.use3dIcons);

            EditorGUI.BeginDisabled(!GizmoUtility.use3dIcons);
            GizmoUtility.iconSize = EditorGUILayout.Slider("3D Icon Size", GizmoUtility.iconSize, 0f, 1f);
            EditorGUI.EndDisabled();

            m_Scroll = EditorGUILayout.BeginScrollView(m_Scroll);

            foreach (var go in Selection.gameObjects)
            {
                GUILayout.Label($"{go.name} Gizmos", EditorStyles.boldLabel);

                EditorGUI.indentLevel++;
                foreach (var component in go.GetComponents<Component>())
                {
                    // A component can have gizmos, an icon, both, or neither. A gizmo can also be disabled (the Editor
                    // is collapsed in the Inspector).
                    if (GizmoUtility.TryGetGizmoInfo(component.GetType(), out GizmoInfo info))
                    {
                        EditorGUI.BeginChangeCheck();

                        if (info.hasGizmo)
                            info.gizmoEnabled = EditorGUILayout.Toggle($"{info.name} Gizmo", info.gizmoEnabled);

                        if (info.hasIcon)
                            info.iconEnabled = EditorGUILayout.Toggle($"{info.name} Icon", info.iconEnabled);

                        if (EditorGUI.EndChangeCheck())
                            GizmoUtility.ApplyGizmoInfo(info);
                    }
                }

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.EndScrollView();
        }
    }
}
```

## Static Properties

| Property                                                                             | Description                                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [iconSize](/engine/6000.3/script-reference/unityeditor/gizmoutility/iconsize.md)     | Control the size that 3D icons render in the Scene View.                                                                                                                                                              |
| [use3dIcons](/engine/6000.3/script-reference/unityeditor/gizmoutility/use3dicons.md) | Determines whether icons in the Scene View are a fixed size (false) or scaled relative to distance from the camera and [GizmoUtility.iconSize](/engine/6000.3/script-reference/unityeditor/gizmoutility/iconsize.md). |

## Static Methods

| Method                                                                                         | Description                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ApplyGizmoInfo](/engine/6000.3/script-reference/unityeditor/gizmoutility/applygizmoinfo.md)   | Apply [GizmoInfo.gizmoEnabled](/engine/6000.3/script-reference/unityeditor/gizmoinfo/gizmoenabled.md) and [GizmoInfo.iconEnabled](/engine/6000.3/script-reference/unityeditor/gizmoinfo/iconenabled.md) for a [GizmoInfo](/engine/6000.3/script-reference/unityeditor/gizmoinfo.md) object. |
| [GetGizmoInfo](/engine/6000.3/script-reference/unityeditor/gizmoutility/getgizmoinfo.md)       | Get [GizmoInfo](/engine/6000.3/script-reference/unityeditor/gizmoinfo.md) for all components with gizmos or icons in the project.                                                                                                                                                           |
| [SetGizmoEnabled](/engine/6000.3/script-reference/unityeditor/gizmoutility/setgizmoenabled.md) | Enable or disable gizmo rendering in the Scene View for a component type. Gizmos are the simple lines and guides drawn by component editors. For example, the Camera frustum guidelines are gizmos.                                                                                         |
| [SetIconEnabled](/engine/6000.3/script-reference/unityeditor/gizmoutility/seticonenabled.md)   | Enable or disable icon rendering for all objects in the Scene View for a component type.                                                                                                                                                                                                    |
| [TryGetGizmoInfo](/engine/6000.3/script-reference/unityeditor/gizmoutility/trygetgizmoinfo.md) | Get a GizmoInfo for a type if it exists.                                                                                                                                                                                                                                                    |
