docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class GridBrushEditor

    Editor for GridBrush.

    Inheritance
    object
    Object
    ScriptableObject
    Editor
    GridBrushEditorBase
    GridBrushEditor
    Inherited Members
    GridBrushEditorBase.OnPaintInspectorGUI()
    GridBrushEditorBase.OnSceneGUI(GridLayout, GameObject)
    GridBrushEditorBase.OnMouseEnter()
    GridBrushEditorBase.OnToolActivated(GridBrushBase.Tool)
    Editor.SaveChanges()
    Editor.DiscardChanges()
    Editor.CreateEditorWithContext(Object[], Object, Type)
    Editor.CreateEditorWithContext(Object[], Object)
    Editor.CreateCachedEditorWithContext(Object, Object, Type, ref Editor)
    Editor.CreateCachedEditorWithContext(Object[], Object, Type, ref Editor)
    Editor.CreateCachedEditor(Object, Type, ref Editor)
    Editor.CreateCachedEditor(Object[], Type, ref Editor)
    Editor.CreateEditor(Object)
    Editor.CreateEditor(Object, Type)
    Editor.CreateEditor(Object[])
    Editor.CreateEditor(Object[], Type)
    Editor.DrawPropertiesExcluding(SerializedObject, params string[])
    Editor.DrawDefaultInspector()
    Editor.Repaint()
    Editor.OnInspectorGUI()
    Editor.CreateInspectorGUI()
    Editor.RequiresConstantRepaint()
    Editor.DrawHeader()
    Editor.OnHeaderGUI()
    Editor.ShouldHideOpenButton()
    Editor.DrawFoldoutInspector(Object, ref Editor)
    Editor.HasPreviewGUI()
    Editor.CreatePreview(VisualElement)
    Editor.GetPreviewTitle()
    Editor.OnPreviewGUI(Rect, GUIStyle)
    Editor.OnInteractivePreviewGUI(Rect, GUIStyle)
    Editor.OnPreviewSettings()
    Editor.GetInfoString()
    Editor.DrawPreview(Rect)
    Editor.ReloadPreviewInstances()
    Editor.UseDefaultMargins()
    Editor.MoveNextTarget()
    Editor.ResetTarget()
    Editor.hasUnsavedChanges
    Editor.saveChangesMessage
    Editor.target
    Editor.targets
    Editor.serializedObject
    Editor.finishedDefaultHeaderGUI
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetEntityId()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEditor.Tilemaps
    Assembly: Unity.2D.Tilemap.Editor.dll
    Syntax
    [MovedFrom(true, "UnityEditor", "UnityEditor", null)]
    [CustomEditor(typeof(GridBrush))]
    public class GridBrushEditor : GridBrushEditorBase

    Properties

    brush

    The GridBrush that is the target for this editor.

    Declaration
    public GridBrush brush { get; }
    Property Value
    Type Description
    GridBrush

    canChangeZPosition

    Whether the GridBrush can change Z Position.

    Declaration
    public override bool canChangeZPosition { get; set; }
    Property Value
    Type Description
    bool
    Overrides
    GridBrushEditorBase.canChangeZPosition

    icon

    Returns an icon identifying the Grid Brush.

    Declaration
    public override Texture2D icon { get; }
    Property Value
    Type Description
    Texture2D
    Overrides
    GridBrushEditorBase.icon

    shouldSaveBrushForSelection

    Whether the Brush is in a state that should be saved for selection.

    Declaration
    public override bool shouldSaveBrushForSelection { get; }
    Property Value
    Type Description
    bool
    Overrides
    GridBrushEditorBase.shouldSaveBrushForSelection

    tooltip

    Describes the usage of the GridBrush.

    Declaration
    public override string tooltip { get; }
    Property Value
    Type Description
    string
    Overrides
    GridBrushEditorBase.tooltip

    validTargets

    Returns all valid targets that the brush can edit.

    Declaration
    public override GameObject[] validTargets { get; }
    Property Value
    Type Description
    GameObject[]
    Overrides
    GridBrushEditorBase.validTargets
    Remarks

    Valid targets for the GridBrush are any GameObjects with a Tilemap component.

    Methods

    BoxFillPreview(GridLayout, GameObject, BoundsInt)

    Does a preview of what happens when a GridBrush.BoxFill is done with the same parameters.

    Declaration
    public virtual void BoxFillPreview(GridLayout gridLayout, GameObject brushTarget, BoundsInt position)
    Parameters
    Type Name Description
    GridLayout gridLayout

    Grid to box fill data to.

    GameObject brushTarget

    Target of box fill operation. By default the currently selected GameObject.

    BoundsInt position

    The bounds to box fill data to.

    ClearPreview()

    Clears any preview drawn previously by the GridBrushEditor.

    Declaration
    public virtual void ClearPreview()

    ErasePreview(GridLayout, GameObject, Vector3Int)

    Displays a preview of the Tile (after erasure) on the cell of a grid at the given coordinates of the cell.

    Declaration
    public virtual void ErasePreview(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
    Parameters
    Type Name Description
    GridLayout gridLayout

    The grid to paint data to.

    GameObject brushTarget

    The target of the erase operation. This is the currently selected GameObject by default.

    Vector3Int position

    The coordinates of the cell to paint data to.

    Remarks

    The GridBrush will paint preview Sprites of the Tiles (after erasure) into its brush cells on an associated Tilemap. This will not instantiate objects associated with the painted Tiles.

    FloodFillPreview(GridLayout, GameObject, Vector3Int)

    Does a preview of what happens when a GridBrush.FloodFill is done with the same parameters.

    Declaration
    public virtual void FloodFillPreview(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
    Parameters
    Type Name Description
    GridLayout gridLayout

    Grid to paint data to.

    GameObject brushTarget

    Target of the flood fill operation. By default the currently selected GameObject.

    Vector3Int position

    The coordinates of the cell to flood fill data to.

    OnDisable()

    Deinitialises the GridBrushEditor.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    Initializes the GridBrushEditor.

    Declaration
    protected virtual void OnEnable()

    OnMouseLeave()

    Callback when the mouse cursor leaves and editing area.

    Declaration
    public override void OnMouseLeave()
    Overrides
    GridBrushEditorBase.OnMouseLeave()
    Remarks

    Cleans up brush previews.

    OnPaintSceneGUI(GridLayout, GameObject, BoundsInt, Tool, bool)

    Callback for painting the GUI for the GridBrush in the Scene View.

    Declaration
    public override void OnPaintSceneGUI(GridLayout gridLayout, GameObject brushTarget, BoundsInt position, GridBrushBase.Tool tool, bool executing)
    Parameters
    Type Name Description
    GridLayout gridLayout

    Grid that the brush is being used on.

    GameObject brushTarget

    Target of the GridBrushBase::ref::Tool operation. By default the currently selected GameObject.

    BoundsInt position

    Current selected location of the brush.

    GridBrushBase.Tool tool

    Current GridBrushBase::ref::Tool selected.

    bool executing

    Whether brush is being used.

    Overrides
    GridBrushEditorBase.OnPaintSceneGUI(GridLayout, GameObject, BoundsInt, GridBrushBase.Tool, bool)

    OnSelectionInspectorGUI()

    Callback for drawing the Inspector GUI when there is an active GridSelection made in a Tilemap.

    Declaration
    public override void OnSelectionInspectorGUI()
    Overrides
    GridBrushEditorBase.OnSelectionInspectorGUI()

    OnSelectionSceneGUI(GridLayout, GameObject)

    Callback for painting custom gizmos when there is an active GridSelection made in a GridLayout.

    Declaration
    public override void OnSelectionSceneGUI(GridLayout gridLayout, GameObject brushTarget)
    Parameters
    Type Name Description
    GridLayout gridLayout

    Grid that the brush is being used on.

    GameObject brushTarget

    Target of the GridBrushBase::ref::Tool operation. By default the currently selected GameObject.

    Overrides
    GridBrushEditorBase.OnSelectionSceneGUI(GridLayout, GameObject)
    Remarks

    Override this to show custom gizmos for the current selection.

    OnToolDeactivated(Tool)

    Callback when the GridBrush Tool is deactivated.

    Declaration
    public override void OnToolDeactivated(GridBrushBase.Tool tool)
    Parameters
    Type Name Description
    GridBrushBase.Tool tool

    GridBrush Tool that is deactivated.

    Overrides
    GridBrushEditorBase.OnToolDeactivated(GridBrushBase.Tool)
    Remarks

    Cleans up brush previews.

    PaintPreview(GridLayout, GameObject, Vector3Int)

    Paints preview data into a cell of a grid given the coordinates of the cell.

    Declaration
    public virtual void PaintPreview(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
    Parameters
    Type Name Description
    GridLayout gridLayout

    The grid to paint data to.

    GameObject brushTarget

    The target of the paint operation. This is the currently selected GameObject by default.

    Vector3Int position

    The coordinates of the cell to paint data to.

    Remarks

    The GridBrush will paint preview Sprites in its brush cells onto an associated Tilemap. This will not instantiate objects associated with the painted Tiles.

    RegisterUndo(GameObject, Tool)

    Callback for registering an Undo action before the GridBrushBase does the current GridBrushBase::ref::Tool action.

    Declaration
    public override void RegisterUndo(GameObject brushTarget, GridBrushBase.Tool tool)
    Parameters
    Type Name Description
    GameObject brushTarget

    Target of the GridBrushBase::ref::Tool operation. By default the currently selected GameObject.

    GridBrushBase.Tool tool

    Current GridBrushBase::ref::Tool selected.

    Overrides
    GridBrushEditorBase.RegisterUndo(GameObject, GridBrushBase.Tool)
    Remarks

    Implement this for any special Undo behaviours when a brush is used.

    RenderStaticPreview(string, Object[], int, int)

    Creates a static preview of the GridBrush with its current selection.

    Declaration
    public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
    Parameters
    Type Name Description
    string assetPath

    The asset to operate on.

    Object[] subAssets

    An array of all Assets at assetPath.

    int width

    Width of the created texture.

    int height

    Height of the created texture.

    Returns
    Type Description
    Texture2D

    Generated texture or null.

    Overrides
    Editor.RenderStaticPreview(string, Object[], int, int)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)