Search Unity

How to spawn Tiles using Brackley's level Editor

Discussion in '2D' started by azverndias09, Jun 8, 2021.

  1. azverndias09

    azverndias09

    Joined:
    May 24, 2021
    Posts:
    2
    If you have seen this video by Brackleys:


    The video shows how to make a level editor by using a textured image where each colored pixel corresponds to a prefab of a gameObject, scripts are written to read each pixel from the image, detect colors and then spawn in the gameobject at that location in the game world in relation to where the pixel was in the texture image.

    This would be real helpful when designing new levels, but how would i use it to spawn tiles from a tile Pallete into a tilemap, That would involve creating a prefab of a tile from the tile Pallete, and Im not sure if that's possible, could anyone show me a work around to that?
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi @azverndias09

    Simply replace the method that places a prefab with a method that places tiles in your tilemap.

    "how would i use it to spawn tiles from a tile Pallete into a tilemap,"

    You don't spawn anything from Tile Palette, it is mostly for painting tiles manually in Editor. You could add your tiles to some list or fields and then pick from there based on the color you encounter while reading the source image.
     
    Last edited: Jun 8, 2021