Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Is it possible to change active tilemap in tile palette through a script ?

Discussion in 'Editor & General Support' started by dejan-cesarov, Oct 31, 2018.

  1. dejan-cesarov

    dejan-cesarov

    Joined:
    Oct 31, 2018
    Posts:
    6
    Lets say we have multiple tilemaps, and many different tiles in one tile palette.
    What i would like to achieve is to automatically change active tilemap based on what tile from the palette is selected, so i don't have to change active tilemap manually each time i want to draw with different tile on different tilemap.
     
    arkogelul likes this.
  2. dejan-cesarov

    dejan-cesarov

    Joined:
    Oct 31, 2018
    Posts:
    6
    A bit more detailed approach would be:

    1. I click on tile in tile palette, get the name of the selected tile.
    2. In code i customize what is appropriate tilemap for that tile name.
    3. I set that tilemap as active tilemap.

    If anyone else has other idea or even better a working solution, feel free to share :)
     
    arkogelul likes this.
  3. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    105
    I'm looking for the same feature. I managed to get parameters from the picked tile in the palette, but I can't find any access to the active tilemap.
     
  4. dejan-cesarov

    dejan-cesarov

    Joined:
    Oct 31, 2018
    Posts:
    6
    Could you share how did you get parameters for picked tile ?
     
  5. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    105
  6. dejan-cesarov

    dejan-cesarov

    Joined:
    Oct 31, 2018
    Posts:
    6
  7. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    105
  8. dejan-cesarov

    dejan-cesarov

    Joined:
    Oct 31, 2018
    Posts:
    6
    Thanks!
    Will try to get it to work when i get the time :)