reckfellENGINE

TileSetScenesCollectionSource

Exposes a set of scenes as tiles for a TileSet resource.

On this page
class TileSetScenesCollectionSourceReckfellSharpInherits TileSetSource

Exposes a set of scenes as tiles for a TileSet resource.

When placed on a TileMapLayer, tiles from TileSetScenesCollectionSource will automatically instantiate an associated scene at the cell's position in the TileMapLayer. Scenes are instantiated as children of the TileMapLayer after it enters the tree, at the end of the frame (their creation is deferred). If you add/remove a scene tile in the TileMapLayer that is already inside the tree, the TileMapLayer will automatically instantiate/free the scene accordingly. Note: Scene tiles all occupy one tile slot and instead use alternate tile ID to identify scene index. TileSetSource.GetTilesCount will always return 1. Use TileSetScenesCollectionSource.GetSceneTilesCount to get a number of scenes in a TileSetScenesCollectionSource. Use this code if you want to find the scene path at a given tile in TileMapLayer:

C#
int sourceId = tileMapLayer.GetCellSourceId(new Vector2I(x, y));
if (sourceId > -1)
{
    TileSetSource source = tileMapLayer.TileSet.GetSource(sourceId);
    if (source is TileSetScenesCollectionSource sceneSource)
    {
        int altId = tileMapLayer.GetCellAlternativeTile(new Vector2I(x, y));
        // The assigned PackedEntity.
        PackedEntity scene = sceneSource.GetSceneTileScene(altId);
    }
}

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

TileSetScenesCollectionSourceConstructor
# TileSetScenesCollectionSource
C#
public TileSetScenesCollectionSource();

Methods11

CreateSceneTileint
# CreateSceneTile
C#
public int CreateSceneTile(PackedEntity packedScene, int idOverride = -1);

Creates a scene-based tile out of the given scene. Returns a newly generated unique ID.

Parameters
NameTypeDefault
packedScenePackedEntity—
idOverrideint-1
Returns int
GetNextSceneTileIdint
# GetNextSceneTileId
C#
public int GetNextSceneTileId();

Returns the scene ID a following call to TileSetScenesCollectionSource.CreateSceneTile would return.

Returns int
GetSceneTileDisplayPlaceholderbool
# GetSceneTileDisplayPlaceholder
C#
public bool GetSceneTileDisplayPlaceholder(int id);

Returns whether the scene tile with id displays a placeholder in the editor.

Parameters
NameTypeDefault
idint—
Returns bool
GetSceneTileIdint
# GetSceneTileId
C#
public int GetSceneTileId(int index);

Returns the scene tile ID of the scene tile at index.

Parameters
NameTypeDefault
indexint—
Returns int
GetSceneTileScenePackedEntity
# GetSceneTileScene
C#
public PackedEntity GetSceneTileScene(int id);

Returns the PackedEntity resource of scene tile with id.

Parameters
NameTypeDefault
idint—
Returns PackedEntity
GetSceneTilesCountint
# GetSceneTilesCount
C#
public int GetSceneTilesCount();

Returns the number or scene tiles this TileSet source has.

Returns int
HasSceneTileIdbool
# HasSceneTileId
C#
public bool HasSceneTileId(int id);

Returns whether this TileSet source has a scene tile with id.

Parameters
NameTypeDefault
idint—
Returns bool
RemoveSceneTilevoid
# RemoveSceneTile
C#
public void RemoveSceneTile(int id);

Remove the scene tile with id.

Parameters
NameTypeDefault
idint—
SetSceneTileDisplayPlaceholdervoid
# SetSceneTileDisplayPlaceholder
C#
public void SetSceneTileDisplayPlaceholder(int id, bool displayPlaceholder);

Sets whether or not the scene tile with id should display a placeholder in the editor. This might be useful for scenes that are not visible.

Parameters
NameTypeDefault
idint—
displayPlaceholderbool—
SetSceneTileIdvoid
# SetSceneTileId
C#
public void SetSceneTileId(int id, int newId);

Changes a scene tile's ID from id to new_id. This will fail if there is already a tile with an ID equal to new_id.

Parameters
NameTypeDefault
idint—
newIdint—
SetSceneTileScenevoid
# SetSceneTileScene
C#
public void SetSceneTileScene(int id, PackedEntity packedScene);

Assigns a PackedEntity resource to the scene tile with id. This will fail if the scene does not extend CanvasItem, as positioning properties are needed to place the scene on the TileMapLayer.

Parameters
NameTypeDefault
idint—
packedScenePackedEntity—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.