AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

RB.MapDataSet< T >

Method  -  Static

public static void MapDataSet< T >(int layer, Vector2i tilePos, T data)

Parameters

layer int Tilemap layer
tilePos Vector2i Tile position
data T Data

Returns

Nothing.

Description

Set user tile data at the given layer and tilePos. This data could be anything, including simple primitive type, or structs. This can be very useful for storing information about the features of a tile.

Example

const int LAYER_TERRAIN = 0;

void Initialize() {
    int width = 16;
    int height = 16;

    for (int x = 0; x < 16; x++) {
        for (int x = 0; x < 16; x++) {
            blocking = Random.Range(02) == 0 ? false : true;

            RB.MapDataSet<bool>(LAYER_TERRAIN, new Vector2i(x, y), blocking);
        }
    }
}

void Update() {
    bool blocking = RB.MapDataGet<bool>(LAYER_TERRAIN, playerTilePos);

    if (blocking) {
        KillPlayer();
    }
}

See Also

RB.MapDataGet<T>
RB.MapLayerSpriteSheetSet

See Docs

Features - Tilemaps
Features - Setting or Getting Tile Info