Class GridPaintingState
GridPaintingState controls the state of objects for painting with a Tile Palette.
Inherited Members
Namespace: UnityEditor .Tilemaps
Assembly: Unity.2D.Tilemap.Editor.dll
Syntax
public class GridPaintingState : ScriptableSingleton<GridPaintingState>
Remarks
Utilize this class to get and set the current painting target and brush for painting with the Tile Palette.
Properties
activeBrushEditor
The currently active editor for the active brush for the Tile Palette
Declaration
public static GridBrushEditorBase activeBrushEditor { get; }
Property Value
Type | Description |
---|---|
Grid |
brushPickStore
Returns a store of brush selection data for the current gridBrush
Declaration
public static GridBrushPickStore brushPickStore { get; }
Property Value
Type | Description |
---|---|
Grid |
brushes
Returns all available brushes for the Tile Palette
Declaration
public static IList<GridBrushBase> brushes { get; }
Property Value
Type | Description |
---|---|
IList<Grid |
gridBrush
The currently active brush for the Tile Palette
Declaration
public static GridBrushBase gridBrush { get; set; }
Property Value
Type | Description |
---|---|
Grid |
isEditing
Returns whether GridPaintingState is active for editing.
Declaration
public static bool isEditing { get; }
Property Value
Type | Description |
---|---|
bool |
isPaletteEditable
Whether the active palette can be edited.
Declaration
public static bool isPaletteEditable { get; }
Property Value
Type | Description |
---|---|
bool |
lastSceneViewGridPosition
The last active grid position on the SceneView
when the GridPaintingState
is active.
Declaration
public static Vector3Int lastSceneViewGridPosition { get; }
Property Value
Type | Description |
---|---|
Vector3Int |
lastSceneViewMousePosition
The last active mouse position on the SceneView
when the GridPaintingState
is active.
Declaration
public static Vector2 lastSceneViewMousePosition { get; }
Property Value
Type | Description |
---|---|
Vector2 |
palette
The currently active palette GameObject for the Tile Palette
Declaration
public static GameObject palette { get; set; }
Property Value
Type | Description |
---|---|
Game |
palettes
Returns all available Palette GameObjects for the Tile Palette
Declaration
public static IList<GameObject> palettes { get; }
Property Value
Type | Description |
---|---|
IList<Game |
scenePaintTarget
The currently active target for the Tile Palette
Declaration
public static GameObject scenePaintTarget { get; set; }
Property Value
Type | Description |
---|---|
Game |
validTargets
A list of all valid targets that can be set as an active target for the Tile Palette
Declaration
public static GameObject[] validTargets { get; }
Property Value
Type | Description |
---|---|
Game |
Methods
IsPartOfActivePalette(GameObject)
Checks if target GameObject is part of the active Palette.
Declaration
public static bool IsPartOfActivePalette(GameObject target)
Parameters
Type | Name | Description |
---|---|---|
Game |
target | GameObject to check. |
Returns
Type | Description |
---|---|
bool | True if the target GameObject is part of the active palette. False if not. |
SetPickOnActiveGridBrush(bool, int)
Retrieves a stored selection from the current Active GridBrushPickStore and copies it into the Active GridBrush.
Declaration
public static void SetPickOnActiveGridBrush(bool user, int index)
Parameters
Type | Name | Description |
---|---|---|
bool | user | Use user selection or last selection. |
int | index | Index of selection from store to use. |
Events
beforePaletteChanged
Callback before the Tile Palette's active palette GameObject has changed.
Declaration
public static event Action beforePaletteChanged
Event Type
Type | Description |
---|---|
Action |
brushChanged
Callback when the Tile Palette's active brush has changed.
Declaration
public static event Action<GridBrushBase> brushChanged
Event Type
Type | Description |
---|---|
Action<Grid |
brushPickChanged
Callback when the Tile Palette's active brush's selection has changed.
Declaration
public static event Action brushPickChanged
Event Type
Type | Description |
---|---|
Action |
brushPickStoreChanged
Callback when the Tile Palette's brush selection store has changed.
Declaration
public static event Action brushPickStoreChanged
Event Type
Type | Description |
---|---|
Action |
brushToolsChanged
Callback when the Tile Palette's active brush tools have changed.
Declaration
public static event Action brushToolsChanged
Event Type
Type | Description |
---|---|
Action |
editModeChanged
Callback when Tile Palette edit mode has changed.
Declaration
public static event Action editModeChanged
Event Type
Type | Description |
---|---|
Action |
paletteChanged
Callback when the Tile Palette's active palette GameObject has changed.
Declaration
public static event Action<GameObject> paletteChanged
Event Type
Type | Description |
---|---|
Action<Game |
palettesChanged
Callback when the Tile Palette's list of palettes has changed
Declaration
public static event Action palettesChanged
Event Type
Type | Description |
---|---|
Action |
scenePaintTargetChanged
Callback when the Tile Palette's active target has changed
Declaration
public static event Action<GameObject> scenePaintTargetChanged
Event Type
Type | Description |
---|---|
Action<Game |
scenePaintTargetEdited
Callback when the Tile Palette's active target has been edited
Declaration
public static event Action<GameObject> scenePaintTargetEdited
Event Type
Type | Description |
---|---|
Action<Game |
validTargetsChanged
Callback when the Tile Palette's valid targets has changed.
Declaration
public static event Action validTargetsChanged
Event Type
Type | Description |
---|---|
Action |