RB.MapSpriteGet
Method - Static
public static int MapSpriteGet(int layer, Vector2i tilePos)
|
Parameters
layer
|
int
|
Map layer
|
tilePos
|
Vector2i
|
Tile position
|
Returns
int
Sprite index or id
DescriptionGet the tilemap sprite at the given layer and tile position. If the the sprite sheet set with RB.MapLayerSpriteSheetSet is from an image grid then the sprite corresponds to the sprite index in the sprite sheet. If the sprite sheet represents a sprite pack then sprite corresponds to the packed sprite id. Exampleconst int LAYER_TERRAIN = 0;
void Update() { int tile = RB.MapSpriteGet(LAYER_TERRAIN, playerTilePos);
if (tile == RB.PackedSpriteID("fire").id) { playerHealth -= 1; } } |
See AlsoRB.MapSpriteSet RB.MapLayerSpriteSheetSetSee DocsFeatures - Tilemaps Features - Setting or Getting Tile Info |