Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to access Tile Palette from code ?

Discussion in 'Editor & General Support' started by eses, Feb 28, 2018.

  1. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi!

    So my question is how to access Tile Palette from editor code.

    I made a simple editor window to create new tile palettes and to add tile assets (more like a test).

    However, I can't quite find out how to get Tile Palette window, and set my selected Palette asset as active palette.

    Any ideas?
     
  2. k76

    k76

    Joined:
    Oct 12, 2014
    Posts:
    12
    I too would like to know this. I've searched all over the scripting API documentation and can't find a way to do this. In particular, I'd like to be able to change the active tilemap through code.
     
    eses likes this.
  3. fabiopicchi

    fabiopicchi

    Joined:
    Jan 22, 2016
    Posts:
    22
    Also very interested. I want to programatically build my palette as it is composed of 768 tiles :(
     
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @fabiopicchi and @KalebGrace

    I could answer to this question myself...

    "I can't quite find out how to get Tile Palette window, and set my selected Palette asset as active palette."

    What a solution - just do the opposite - Select the asset in folder, and it gets shown in palette!

    Eventually, I ended up with this (tileset is not mine, some test set):



    Edit: now I noticed - this post would be better placed in "Extensions & OnGUI"...
     
    Last edited: Sep 13, 2018
    k76 and fabiopicchi like this.