Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

I made a tilemap brush script (2D preview 4)!

Discussion in '2D Experimental Preview' started by DDaddySupreme, Jun 15, 2017.

  1. DDaddySupreme

    DDaddySupreme

    Joined:
    Jun 3, 2017
    Posts:
    10
    The terrain brush in the previewR401 demo was the closest to what I wanted, but it rotates the tiles, which doesn't work for what I want to do, so I made one that doesn't rotate the tiles for the 2D preview 4 (2917.1.0x2-2D-Build)
    https://www.dropbox.com/s/toekg5dydfxp0ku/ConnectedTextures unity 2D preview 4 tilemap.zip?dl=0
    The zip in the Dropbox link contains a unity package, the script itself just in case there's some weird problem, and an example of the spritesheet I'm going to use for it, with green being edges/corners, and light grey being the currently unused front of the walls.

    To use the sprite sheet, import it, switch its type to sprite(2D) and select multiple, then in the sprite editor, divide it into 32x32 pixel squares (or you can scale the image up. As long as there's 59 squares not including transparency). Then right click/create/tilemap/connected. Currently you have to set the array in the asset to a size of 59 and drag each tile individually into the corresponding element, but I'm going to try to make it more automatic.

    I apologize if this isn't where or how I should be posting this, I'm pretty new. I was going to put it on the asset store, but I'm just a hobbyist so I don't have a website yet.

    Feel free to ask any questions, or tell me what I'm doing wrong.

    Edit: I've updated it and improved my code. Now, instead of needing to put every sprite into an array manually, you just need the main sprites name in a "Resources/SpriteSheets" folder. Feel free to edit this to fit your needs. I also got rid of some old commented out code that wasn't doing anything.
     
    Last edited: Jun 24, 2017
    terrypaton1 likes this.
  2. Johaness_Reuben

    Johaness_Reuben

    Joined:
    Jan 27, 2016
    Posts:
    253
  3. DDaddySupreme

    DDaddySupreme

    Joined:
    Jun 3, 2017
    Posts:
    10
    I've updated the files in the dropbox link. Made the image layout a little better, updated the code to match it, and included a txt document with a "How to" on it