以下の内容はhttps://baba-s.hatenablog.com/entry/2019/10/01/070000より取得しました。


【Unity】Tilemap で Tile Palette の Active Tilemap をスクリプトから変更する方法

概要

using System.Reflection;
using UnityEditor;

public class Example
{
    [MenuItem( "Tools/Hoge" )]
    private static void Hoge()
    {
        var assembly = typeof( AssetDatabase ).Assembly;
        var type     = assembly.GetType( "UnityEditor.GridPaintingState" );
        var property = type.GetProperty( "scenePaintTarget", BindingFlags.Public | BindingFlags.Static );

        // 第2引数で Active Tilemap に設定したいゲームオブジェクトを指定する
        property.SetValue( type, Selection.activeGameObject );
    }
}

上記のようなコードを記述することで

f:id:baba_s:20190928135749p:plain

Tile Palette の Active Tilemap をスクリプトから変更できます




以上の内容はhttps://baba-s.hatenablog.com/entry/2019/10/01/070000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14