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

UniTile - 2d Tile-based Map Editor within Unity

Discussion in 'Assets and Asset Store' started by mudloop, Jan 6, 2011.

  1. littleelkgirl

    littleelkgirl

    Joined:
    May 15, 2012
    Posts:
    11
    Thanks for that link MarigoldFleur. That is by far the most comprehensive tutorial on 2d platformers I have ever seen.

    I used a system similar to what you describe in an old tile-based flash game I made. I never implemented slopes though. Your post has made me consider using such a system in Unity as well.

    Here is a link to my old game:
    http://www.minijuegos.com/Johnny-Monochrome/8120
     
  2. dryarko

    dryarko

    Joined:
    Jun 15, 2012
    Posts:
    10
    Does the amount of layers/the size of the tile influence on performance? I've got 15 unitile layers; Tile size - 32pixels. size of the layer is 200x50 units. My FPS characteristic is rather low(i'm testing my project on the 1st IPad) ~ 25 - 30 fps.
     
  3. MarigoldFleur

    MarigoldFleur

    Joined:
    May 12, 2012
    Posts:
    1,353
    Don't quote me on this since I'm not an expert on mobile stuff or anything, but that sounds like it'd reeeaaallllllyyy push your draw calls up, which would affect performance quite a bit.
     
  4. deis

    deis

    Joined:
    Sep 17, 2009
    Posts:
    29
    Picked up UniTile the other day and am loving it thus far!

    One major question I have though is the workflow with prefabs. Currently I am working on a top-down game. I sort of understand how to make a prefab attach to a Tile with the Tile Properties, but when I try to add them to the map with an Object Layer, nothing appears. I am sure I am just going about it wrong. What is the typical process for this?

    My end goal is to just attach prefabs to objects with scripts for handling various things like AI and what not.
     
  5. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Hi,

    There are two ways to instantiate prefabs :
    - Object layers : Here you can just select a bunch of prefabs, and instantiate and position them easily
    - Tile prefabs : You can assign a prefab to each tile in your tileset. They will be instantiated once you press the "create objects" button.
     
  6. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    BTW, UniTile is part of the current asset store sale, so grab it while it's cheap!
     
  7. Zec

    Zec

    Joined:
    Jan 3, 2012
    Posts:
    10
    I'd like to throw in a suggestion to the tile replacer. The issue for me is that the tile replacer restricts tile replacement to only using square rule areas, and it makes it a big hassle to fix things.

    I'll try to give an example, see what the different things mean below:
    x: Wall
    o: Floor
    : "Default tile"

    Currently, one of my rules look like this:

    xo
    oo

    It's supposed to fix the corner wall so it switches into a corner tile. This works fairly well, but the issue here is that whenever I put any other tile in the bottom right tile, it doesn't work, and I'd have to create a massive set of rules to fix that.

    What would be nice here would be if we could use the built in "default tile" that one can set in the tile replacer by clicking the right mouse button. The "default tile" would then be an "ignore this tile in the replacement algorightm" tile, so independant of what I place there, it would just check the Top Right, Top Left and Bottom Left corners. The replacement rule would then look like this:

    xo
    o

    I don't know if I managed to make myself understandable here, but I hope so. Ask me if you're wondering anything about my thoughts on this :)
     
    Last edited: Jul 9, 2012
  8. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    So, basically you want a "wildcard tile" for the replacer? Not a bad idea at all.
     
  9. Zec

    Zec

    Joined:
    Jan 3, 2012
    Posts:
    10
    I suppose that that is what I suggested, yep.
     
  10. Sinperhezine

    Sinperhezine

    Joined:
    Mar 14, 2012
    Posts:
    10
    Can it been use to randomly generate tile maps?
     
  11. deis

    deis

    Joined:
    Sep 17, 2009
    Posts:
    29
    So my prefabs are being created now from the tiles. But, how does everyone go about associating the prefabs that are created, to the displayed tiles? As of right now, the tile and prefab do not seem to have any relationship with one another.

    I am looking to handle my creature's (Tile) AI with scripts attached to the prefab, but the prefab object generated does not know of the TileLayer it was created from nor the specific Tile it is tied to. I am curious if there is something I am misunderstanding about setting this up?

    For now I have created a special class called TileLink.cs:

    Code (csharp):
    1. using UnityEngine;
    2. public class TileLink : MonoBehaviour
    3. {
    4.     public UniTileTile Tile;
    5.     public TileLayer TileLayer;
    6. }
    And inside of TileLayerEditor.cs I have modified the code slightly to add in the following AFTER the conditional instantiation of the prefab:

    Code (csharp):
    1. // CUSTOM MODIFICATION - BY DEIS //
    2.                         TileLink tileLink = instance.AddComponent<TileLink>();
    3.                         tileLink.Tile = tile;
    4.                         tileLink.TileLayer = layer;
    5.                         // END CUSTOM MODIFICATION
    This gives me a way to quickly relate the two objects and handle all the custom AI inside the prefab.
     
    Last edited: Jul 10, 2012
  12. aorata

    aorata

    Joined:
    Feb 10, 2012
    Posts:
    28
    Hello, I have a couple of problems with Unitile or I'm stupid and haven't figured out how to use it.

    First: how do I set the size of the grid to be pixel perfect? if I have a 64x64 tile and put it in the grid, it looks much much bigger. So I just scale the grid down to 0.001 x, 0.001 y, but that is just stupid and it doesn't look pixel perfect.
    What should I do??

    Second: after doing the map and scaling down, the tiles don't look right, I can see the lines that separate the tiles. Before anyone asks, I got the tiles from a single image, so there shouldn't be any white space between them.


    I hope my english was clear enough, and thanks in advance!
     
  13. aorata

    aorata

    Joined:
    Feb 10, 2012
    Posts:
    28
    I don´t recommend this product at all. Bad documentation, bad support, lousy software.

    I didn´t want to pay for sprite manager so I chose this one... big mistake.

    Thank god I have 2dToolkit and they have a tile manager beta version.
     
  14. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    For some reason I haven't been getting mails when there are new replies to this thread lately, possibly since UT changed the login system of the forums. I did get one mail yesterday so it seems to be resolved now. Sorry about this!

    That seems like a good solution to me. If you don't want to hack the UniTile code, I'd suggest creating the links at the start of the project.


    I usually set the camera so 1 unity unit equals 1 pixel. If you don't like that, you can use the "tile output size" to set up what size each tile should be. Don't forget to click the "Rebuild" button after changing this.

    Did you use the TexturePadder as described in the pdf manual? What you are seeing is "edge bleeding", which happens due to floating point precision errors.



    I am sorry about the lack of support, as I explained I was unaware that you needed help due to not getting mails. A lot of people do like the software, but off course you are entitled to that opinion. I do hope that with these answers you get to like it.
     
  15. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    150
    Can you elaborate on this point? I have some tiles that have transparent edge to them (for corner pieces, which is fine) but I have some that are for inner pieces that fill the whole tile space 128x128 on the texture, but shares it's border next to the transparent part of the other tile. My corner pieces display fine while the others have this transparent line that appears and disappears if the camera is in a certain location.

    Could this be solved by UniTile reading a half-pixel into the texture coordinates?

    This post is for Android OpenGL but should translate over to Unity as well: http://stackoverflow.com/questions/3962385/android-opengl-es-texture-bleeding
     
    Last edited: Jul 20, 2012
  16. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    I'm not sure if it could be solved like that. I will investigate. For now, look at the manual for more info on the TexturePadder, or send me a PM/mail if you can't figure it out.
     
  17. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    150
    Thanks for looking into it. I'll keep trying for a bit on my end before I send anything your way.
     
  18. seifer8ff

    seifer8ff

    Joined:
    Aug 14, 2012
    Posts:
    11
    Hi, I purchased UniTile a little while back, and I'm loving it. It's really easy to use, and has a great feature set. One thing that seems to be missing is the ability to create a box collider for a specific tile that has the "is trigger" box checked...Is there a way to do this that I'm missing? I'm aware of how to create a normal collider, but I specifically need the "is trigger" box checked on the collider. Just for reference, I'm trying to go to a battle screen when the player steps on a certain tile.
     
  19. Matkins

    Matkins

    Joined:
    Aug 24, 2009
    Posts:
    152
    Either I'm an idiot or i've got a really strange bug going on. Basically I have rotated the grid so that i can work on the z/x plane, and it's working for 3 layers, but not the 4th layer, despite it being identical. It looks like no tiles get placed down, but then when i rotate the scene camera to an angle i can see that actually the sprites are being placed but on the wrong plane that the grid actually lies on. Is this a bug or am i doing something wrong? Cheers.
     
  20. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Can you send me an example project? I will look into it asap. info at mudloop dot com
     
  21. Matkins

    Matkins

    Joined:
    Aug 24, 2009
    Posts:
    152
    Just incase it got filtered, I have sent you that email now. Thanks.
     
    Last edited: Aug 21, 2012
  22. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Thanks for the notification - I'm already contacted the webhost. I was on a holliday for a while, and got back to that :)
    Should be back up soon.

    EDIT : oh, it's already back.
     
  23. Mike_011972

    Mike_011972

    Joined:
    Jun 8, 2009
    Posts:
    97
    Hi,
    Having a bit of a problem with UniTile.
    Basically trying to create a random scrolling game using several tiny (50*25) UniTile levels which are instantiated as prefabs.
    It does it, but there’s no sprite / textures been displayed (collision groups are still there).
    Also when I try to alter any of the prefabs, it crashes Unity with the following warning:
    “Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption”

    I’m basically creating the prefabs by
    1) Creating a UniTile level
    2) Rebuild the level
    3) Create an empty Prefab
    4) Drag the UniTile level into the Prefab
    5) Delete the original UniTile level.

    I’m pretty new to Unitile and Unity, so it could be simply something stupid I’m doing wrong, but the same process has worked for me before using standard 3D models inside prefabs.

    Any help / hints you could give me would be really helpful (I’m using the latest version of Unity 3..5.5 as well by the way).

    Thanks,
    Mike.
     
  24. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    I've actually never tried making a prefab from a layer - I'll look into it. Can you send me a mail (info [at] mudloop [dot] com) and I'll send you a test version asap.
     
  25. Mike_011972

    Mike_011972

    Joined:
    Jun 8, 2009
    Posts:
    97
    Thanks for the quick reply Mudloop. E-mail sent to you.
     
  26. ArcticPrism

    ArcticPrism

    Joined:
    Sep 25, 2012
    Posts:
    3
    How compatible is UniTile with Ex2d, EZsprite, P2D Sprite, 2D Platformer Starter Kit or Sprite Studio Player?
     
    Last edited: Sep 25, 2012
  27. Daiboken

    Daiboken

    Joined:
    Mar 8, 2011
    Posts:
    28
    We are having problems drawing tiles sized 24x16, the tile size can be rectangular or must be squared?
     
    Last edited: Oct 19, 2012
  28. Daiboken

    Daiboken

    Joined:
    Mar 8, 2011
    Posts:
    28
    Oh we solved it, i don't know if there is a newer version with the bugs corrected but i think the version we have is 1.3.2
    Things to change:
    TileLayerUtil at line 265: layer.tileSize.x -> layer.tileSize.y
    TileLayerUtil at line 385: layer.tileSize.x -> layer.tileSize.y
    UniTileMarker at line 92: layer.tileSize.x -> layer.tileSize.y
    TileReplacer at line 297: layer.tileSize.x -> layer.tileSize.y
     
  29. Saborion

    Saborion

    Joined:
    Jul 20, 2012
    Posts:
    3
    I have a few questions.
    1: Seems to me that using the texture padder is pretty much a must?
    2: If my tiles should be 20*20, and I want the final texture size to be 512, how would I go about creating the original texture (pre texture-padder)?
    3: Any idea why I get the result in the image below? The bar is the original texure with 20*20 tiles, the part on the bottom is how it looks in the game view, after the texture padder has been set up. 20*20 tiles, 1 pixel border size. Seems like it's starting to drift, perfect at first, the one line wrong, then two lines.
     
  30. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Sorry for not replying earlier.

    1. Yes it is, unless you use Point filtering in the textures.
    2. Just leave two empty tiles on the right and at the bottom.
    3. Can you mail me the files? sven at mudloop dot com
     
  31. Ericks89

    Ericks89

    Joined:
    Nov 3, 2012
    Posts:
    39
    I just have a basic question, glad you support multiple layers as that's important for a RPG!
    Can you use unitile for semi 3d? 2.5D? Or is this strict 2D?
     
  32. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    It's strict 2D only.
     
  33. squarelover

    squarelover

    Joined:
    Nov 14, 2012
    Posts:
    31
    in my particular case any number of non square original png source files 128x64 properly captures\draws only if they stack up in one row in tileset. in my case this issue leads to consequences five of them like http://clip2net.com/s/2v7zS should be http://clip2net.com/s/2v7zl and finally http://clip2net.com/s/2v7z5 and thats unappropriate for mobile devices. any suggestions ?
    if i add 2 and 3rd row in texture and in tileset they stop to draw normally. 1st row pick and draws as it should. when i draw second row tiles unitile draws cropped 3rd row.when i pick 3rd row, unitile doest draw anything at all. maybe i dont know anything basic about unitile like so maybe it doesnt support non square tiles? or anything other. forum search doesnt help really
     
  34. AXXE78

    AXXE78

    Joined:
    Oct 9, 2010
    Posts:
    74
    Does UniTile support runtime tile instancing? Someone asked it before, just checking if there are some news about this.
     
  35. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi, I just bought UniTile and it's working perfect! I have one problem though, i have a sprite sheet of sprites that are 16x16 sprites. But i can't get them to fit when i add them and set the configuration for my layer to 16x16 sprites. The sprites have no borders and has on the x axis 13 sprites and on the y axis 50 sprites. Do i need to change some settings?
     
  36. Lowena

    Lowena

    Joined:
    Dec 3, 2012
    Posts:
    3
    Whenever I add a tile to the grid, the Layer gets unselected, so I have to select it in the Hierarchy to place a tile again. How do I fix this? It is very annoying and time-consuming to reselect it every time I want to place a tile.

    Thank you if anyone knows a solution.
     
  37. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    150
    It sounds like Unity isn't in pan mode ("Q" key, hand icon in top-left corner of Unity), the latest version should set you in this mode whenever the layer is selected.

    Hope that helps.
     
  38. Lowena

    Lowena

    Joined:
    Dec 3, 2012
    Posts:
    3
    Thanks! It works perfectly now.
     
  39. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    150
    I'm still not digging the idea of using TexturePadder to get around what seems like bad texture sampling. I just can't see how I have to waste valuable texture space padding things. I also don't see how this method will help when I need to seamlessly mesh different patterned tiles together. I tried the TexturePadder with a simple green tile set ripped from Zelda: Link to the Past and I had subtle issues like a faint light green line which gave a grid effect to the ground, which just means it couldn't get the exact color it needed down.

    From what I'm looking at with NGUI, it doesn't implement any sort of forced texture padding and they are able to execute tiled sprites flawlessly and it has a handy texture atlas system that creates a single texture atlas from images you dynamically add and remove through the editor, none of which does any sort of padding.

    I also found this interesting article when trying to better understand the issue and quite interestingly found the exact same URL referenced inside of NGUI.
    http://drilian.com/2008/11/25/understanding-half-pixel-and-half-texel-offsets/

    EDIT: Here is another relevant article of interest http://stackoverflow.com/questions/11457394/texture-sampling-coordinates-to-render-a-sprite

    EDIT2: Note, according to both articles, it shouldn't be necessary if the target is an Open GL based platform such as Mac, iOS, and Android, but for using the Web Player, Windows Unity Editor, and Windows Player, this problem will exist. Which is why I'm seeing it when testing on my Windows machine as that is what I'm doing my development on.

    It may shed some light on the issue. If you have access to NGUI, I would also suggest checking out some of the helper math functions he created as his code is well documented.

    I'm going to continue looking for ways to solve this issue but looking at the RedrawGroup method makes my head spin a little.

    If you were able to marry the functionality of NGUI's texture atlasing where you could dynamically add individual tile images into an single atlas and import that image info in and create a sort of organized toolbox of tile pieces instead of using a picker on a somewhat small image, I think that would be awesome. It may also lead to clearing up texture sampling issues.

    I really want to see your product continue to improve, it has a lot of potential, but this texture sampling issue and the somewhat kludgy texture padder solution is really hindering my use of it.
     
    Last edited: Dec 4, 2012
  40. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    150
    Glad I was able to help. :D
     
  41. johot

    johot

    Joined:
    Apr 11, 2011
    Posts:
    201
    We just bought UniTile and it seems great (after reading the documentation and trying it out a bit!)!

    However we ran into a problem that we really need help getting solved.

    We are adding UniTile support to an earlier game. When doing the math for calculating the tile size to our current game size in units we need to use an output tile size of 0.6. However it seems that when using an output tile size that is not even, for example 0.6 or 1.5, the tiles will be positioned wrong. Is there a fix we can make in the code ourselves or are we overlooking anything?

    Also when setting the group size to 0 UniTile will crash Unity, however this is not a big problem for us right now. The issue with uneven output tile sizes is though, because it means we need to scale the grid instead until it can be fixed.

    Other than that, thanks for an awesome product!
     
  42. johot

    johot

    Joined:
    Apr 11, 2011
    Posts:
    201
    I also have a small question.

    We love the idea with the tile replacer, once concern though is how to create a good workflow using it? If we draw levels using a basic color and then setup replacer rules for corners etc, how can we after this has been applied go back to the previous "design mode" tile layer? We might want to change something around and after using the tile replacer our designer tiles will be gone right? Can we have two layers, one for designing and one for the final output for example?
     
  43. squarelover

    squarelover

    Joined:
    Nov 14, 2012
    Posts:
    31
    .....* (layer.tileSize.x + layer.borderSize.y * 2f)..... |UniTileMarker script 93 row| seems that replacing that tilesize.x with tilesize.y solves "not square tilesize" marker problem in scene view. still looking for correct displaying and "writing" to the tilelayer.

    added: TileLayerUtil same calculate pattern row 265 DrawTiles ...athf.Floor(data.id / columns) * (layer.tileSize.x + layer.borderSize.y * 2f) + l.... maybe that help loop fixing some sort of bugs maybe not i dont have much time to run deep in bugfix right now
     
    Last edited: Dec 23, 2012
  44. magarcan

    magarcan

    Joined:
    Sep 25, 2012
    Posts:
    34
    Any place where get free tiles?

    Cheers!
     
  45. Jelly-Paladin

    Jelly-Paladin

    Joined:
    Aug 12, 2012
    Posts:
    58
    Try opengameart.org. For totally free tiles, use the advanced search to look for only art with CC0 licenses (public domain). For tiles that are free but require you to credit the original artists, you can also include CC-BY licenses.
     
  46. t-tron

    t-tron

    Joined:
    Dec 6, 2012
    Posts:
    4
    Heard there were some issues with this tool with Unity 4? Can anyone comment on that please?
     
  47. MarigoldFleur

    MarigoldFleur

    Joined:
    May 12, 2012
    Posts:
    1,353
    I can answer this because there IS a single issue with it in Unity 4 that bothered me. It seems that, when selecting the map layer, you aren't automatically put into pan mode, which makes placing tiles a pain in the butt. You can fix this by clicking the hand icon in the upper left of the screen or by pressing Q. Aside from this, Unitile has been working fantastic for me since upgrading to Unity 4.
     
  48. t-tron

    t-tron

    Joined:
    Dec 6, 2012
    Posts:
    4
    Thank you very much! Really appreciate your help. I'm wondering if I should work with UniTile or use Tiled and just import the levels into Unity. I guess, I'll give UniTile a shot. Thanks for your help!
     
  49. JamesMobot

    JamesMobot

    Joined:
    Jul 8, 2010
    Posts:
    170
    Any issues generating colliders with unity4?

    Doesn't seem to work for me.
     
  50. MarigoldFleur

    MarigoldFleur

    Joined:
    May 12, 2012
    Posts:
    1,353
    I just tested it and it worked fine. Did you remember to rebuild your layer after adding the collider info?