Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Tilemap Swap Tile#

Tilemap / Tilemap Swap Tile

Description#

Executes the Swap Tile method on the Tilemap component

Parameters#

Name Description
Change Tile
New Tile

Code#

// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.Tilemaps;
using Unity.Collections;

namespace VisualScript.Runtime
{
    [Title("Tilemap Swap Tile")]
    [Category("Tilemap/Swap Tile")]
    [Description("Executes the Swap Tile method on the Tilemap component")]
    
    [Image(typeof(IconTilemap), ColorTheme.Type.Purple)]
    [Keywords("Tile, Map")]
    
    [Parameter("Change Tile")]
    [Parameter("New Tile")]
    
    [Serializable]
    public class GenInstructionTilemap_SwapTile_2 : Instruction
    {
        [SerializeField] private GetGameObject m_Tilemap = new GetGameObject(
            new GenTypeGameObject_Tilemap()
        );
        
        [SerializeField] private GetScriptableObject m_ChangeTile = new GetScriptableObject();
        
        [SerializeField] private GetScriptableObject m_NewTile = new GetScriptableObject();
        
        protected override string GetTitle(GameObject source)
        {
            string method = TextUtils.ThemeAsKeyword("Swap Tile");
            return $"{this.m_Tilemap} {method} ({this.m_ChangeTile}, {this.m_NewTile})";
        }
        
        protected override Awaitable Run(Args args)
        {
            Tilemap component = this.m_Tilemap.Get<Tilemap>(args);
            if (component == null) return Done;
            
            component.SwapTile(
                (TileBase) this.m_ChangeTile.Get(args),
                (TileBase) this.m_NewTile.Get(args)
            );
            
            return Done;
        }
    }
}

Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.