Tilemap

class in UnityEngine.Tilemaps

/

Inherits from:GridLayout

Switch to Manual

Description

The tile map stores sprites in a layout marked by a Grid component.

Variables

animationFrameRateThe frame rate for all tile animations in the tile map.
cellBoundsReturns the boundaries of the Tilemap in cell size.
colorThe color of the tile map layer.
editorPreviewOriginThe origin of the Tilemap in cell position inclusive of editor preview tiles.
editorPreviewSizeThe size of the Tilemap in cells inclusive of editor preview tiles.
layoutGridGets the Grid associated with this tile map.
localBoundsReturns the boundaries of the Tilemap in local space size.
orientationOrientation of the tiles in the Tilemap.
orientationMatrixOrientation Matrix of the orientation of the tiles in the Tilemap.
originThe origin of the Tilemap in cell position.
sizeThe size of the Tilemap in cells.
tileAnchorGets the anchor point of tiles in the Tilemap.

Public Functions

AddTileFlagsAdds the TileFlags onto the Tile at the given position.
BoxFillDoes a box fill with the given tile on the tile map. Starts from given coordinates and fills the limits from start to end (inclusive).
ClearAllEditorPreviewTilesClears all editor preview tiles that are placed in the Tilemap.
ClearAllTilesClears all tiles that are placed in the Tilemap.
CompressBoundsCompresses the origin and size of the Tilemap to bounds where tiles exist.
ContainsTileReturns true if the Tilemap contains the given tile. Returns false if not.
DeleteCellsRemoves cells from within the Tilemap's bounds.
EditorPreviewBoxFillDoes an editor preview of a box fill with the given tile on the tile map. Starts from given coordinates and fills the limits from start to end (inclusive).
EditorPreviewFloodFillDoes an editor preview of a flood fill with the given tile to place. on the tile map starting from the given coordinates.
FloodFillDoes a flood fill with the given tile to place. on the tile map starting from the given coordinates.
GetCellCenterLocalGet the logical center coordinate of a grid cell in local space.
GetCellCenterWorldGet the logical center coordinate of a grid cell in world space.
GetColliderTypeGets the collider type of a tile given the XYZ coordinates of a cell in the tile map.
GetColorGets the color of a tile given the XYZ coordinates of a cell in the tile map.
GetEditorPreviewColorGets the Color of an editor preview tile given the XYZ coordinates of a cell in the tile map.
GetEditorPreviewSpriteGets the Sprite used in an editor preview tile given the XYZ coordinates of a cell in the tile map.
GetEditorPreviewTileGets the editor preview tile at the given XYZ coordinates of a cell in the tile map.
GetEditorPreviewTileFlagsGets the TileFlags of the editor preview Tile at the given position.
GetEditorPreviewTransformMatrixGets the transform matrix of an editor preview tile given the XYZ coordinates of a cell in the tile map.
GetInstantiatedObjectGets the GameObject instantiated by a tile given the XYZ coordinates of a cell in the tile map.
GetObjectToInstantiateGets the GameObject which will be instantiated by a tile given the XYZ coordinates of a cell in the tile map.
GetSpriteGets the Sprite used in a tile given the XYZ coordinates of a cell in the tile map.
GetTileGets the tile at the given XYZ coordinates of a cell in the tile map.
GetTileFlagsGets the TileFlags of the Tile at the given position.
GetTilesBlockRetrieves an array of tiles with the given bounds.
GetTransformMatrixGets the transform matrix of a tile given the XYZ coordinates of a cell in the tile map.
GetUsedTilesCountGet the total number of different tiles used in the Tilemap.
GetUsedTilesNonAllocFills the given array with the total number of different tiles used in the Tilemap and returns the number of tiles filled.
HasEditorPreviewTileReturns whether there is an editor preview tile at the position.
HasTileReturns whether there is a tile at the position.
InsertCellsInserts cells into the Tilemap.
RefreshAllTilesRefreshes all tiles in the tile map. The tile map will retrieve the rendering data, animation data and other data for all tiles and update all relevant components.
RefreshTileRefreshes a tile at the given coordinates of a cell in the tile map.
RemoveTileFlagsRemoves the TileFlags onto the Tile at the given position.
ResizeBoundsResizes tiles in the Tilemap to bounds defined by origin and size.
SetColliderTypeSets the collider type of a tile given the XYZ coordinates of a cell in the tile map.
SetColorSets the color of a tile given the XYZ coordinates of a cell in the tile map.
SetEditorPreviewColorSets the color of an editor preview tile given the XYZ coordinates of a cell in the tile map.
SetEditorPreviewTileSets an editor preview tile given the XYZ coordinates of a cell in the tile map.
SetEditorPreviewTransformMatrixSets the transform matrix of an editor preview tile given the XYZ coordinates of a cell in the tile map.
SetTileSets a tile at the given XYZ coordinates of a cell in the tile map.
SetTileFlagsSets the TileFlags onto the Tile at the given position.
SetTilesSets an array of tiles at the given XYZ coordinates of the corresponding cells in the tile map.
SetTilesBlockFills bounds with array of tiles.
SetTransformMatrixSets the transform matrix of a tile given the XYZ coordinates of a cell in the tile map.
SwapTileSwaps all existing tiles of changeTile to newTile and refreshes all the swapped tiles.

Events

tilemapTileChangedCallback when Tiles on a Tilemap have changed.

Inherited members

Variables

enabledВключенное Поведение обновляется, выключенное Поведение не обновляется.
isActiveAndEnabledHas the Behaviour had active and enabled called?
gameObjectИгровой объект к которому прикреплён данный компонент. Компонент всегда прикреплён к игровому объекту.
tagТег данного игрового объекта.
transformThe Transform attached to this GameObject.
cellGapThe size of the gap between each cell in the layout.
cellLayoutThe layout of the cells.
cellSizeThe size of each cell in the layout.
cellSwizzleThe cell swizzle for the layout.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Functions

BroadcastMessageВызывает метод названный methodName на каждом MonoBehaviour этого game object-а или любого из его потомков.
CompareTagПомечен ли данный игровой объект тегом tag?
GetComponentReturns the component of Type type if the GameObject has one attached, null if it doesn't. Will also return disabled components.
GetComponentInChildrenВозвращает компонент типа type в GameObject или некоторого его потомка через поиск в глубину.
GetComponentInParentВозвращает все компоненты типа type из GameObject'а или из любого его родителя.
GetComponentsВозвращает все компоненты типа type в GameObject.
GetComponentsInChildrenВозвращает все компоненты типа type в GameObject или любому из его потомков.
GetComponentsInParentВозвращает все компоненты типа type в GameObject или любому из его родителей.
SendMessageВызывает метод с названием methodName в каждом MonoBehaviour в этом игровом объекте.
SendMessageUpwardsВызывает метод с именем methodName в каждом MonoBehaviour в этом игровом объекте и в каждом предке поведения.
TryGetComponentGets the component of the specified type, if it exists.
CellToLocalConverts a cell position to local position space.
CellToLocalInterpolatedConverts an interpolated cell position in floats to local position space.
CellToWorldConverts a cell position to world position space.
GetBoundsLocalReturns the local bounds for a cell at the location.
GetLayoutCellCenterGet the default center coordinate of a cell for the set layout of the Grid.
LocalToCellConverts a local position to cell position.
LocalToCellInterpolatedConverts a local position to cell position.
LocalToWorldConverts a local position to world position.
WorldToCellConverts a world position to cell position.
WorldToLocalConverts a world position to local position.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the object.

Static Functions

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeGets a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961