Search Unity

[RELEASED] Super Tilemap Editor

Discussion in 'Assets and Asset Store' started by CreativeSpore, Feb 21, 2016.

  1. JaseofBase

    JaseofBase

    Joined:
    Jun 12, 2017
    Posts:
    14
    Also question:

    Your example states a pregiven coordinate (30,20).. How do you access the X and Y Get Tile coordinate seperatley?

    What I need to do is be able to access the current X and or current Y coordinate for the pathfinding solution i'm working on. But that data doesn't appear to be exposed. GetTile requires both an x and Y like GetTile(transform.position).. I can't seem to seperate the two variables out.

    So for example:

    I need to reference only the current X tile coordinate of currentTilemap.GetTile(gameObject.transform.position)

    How would I do that?

    Cheers :)


    --EDIT--

    Figured it out TIlemapUtils.GetGridX() or TilemapUtils.GetGridY()

    Might help others!
     
    Last edited: Aug 10, 2017
  2. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Hi there!
    You can do that using the TilemapUtils class:
    Code (CSharp):
    1. int gridX = TilemapUtils.GetGridX(position)
    2. int gridY = TilemapUtils.GetGridX(position)
    EDIT: I saw your edit after answering you :)
     
    JaseofBase likes this.
  3. JaseofBase

    JaseofBase

    Joined:
    Jun 12, 2017
    Posts:
    14
    Another Question!

    How do you use TilemapUtils.IterateTilemapWithAction? Thier is alot of usability examples missing from the Docs i'm having a hard time figuring it out.


    Cheers :)
     
    Last edited: Aug 11, 2017
  4. smartnspiffy

    smartnspiffy

    Joined:
    Jun 22, 2016
    Posts:
    9
    After updating SuperTilemapEditor recently, games won't build anymore. The editor displays the error "Error building Player because scripts had compiler errors"

    From looking at the log, the problem is that the Pyxel Edit importer includes UnityEditor from PyxelEdit.cs and AssetDatabaseUtility.cs.

    Obviously, this is a pretty serious issue...
     
  5. JaseofBase

    JaseofBase

    Joined:
    Jun 12, 2017
    Posts:
    14

    Has anyone used TilemapUtils.IterateTilemapWithAction yet? I really don't know how to use this and could use a little help. Ive tried what I thought was correct, syntax checked out and for all intents a purposes it should have worked, but it doesn't.
     
  6. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    I have submitted a version to fix that issue. Meanwhile you can apply this patch attached. Or even better, remove the Pyxel Edit folder if you are not using it.
     

    Attached Files:

  7. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    You have an example of use in the method commentary:
    Code (CSharp):
    1. /// <summary>
    2. /// Iterate through all the tilemap cells and calls an action for each cell.
    3. /// Ex:
    4. /// void EraseTilesFromTilemap(Tilemap tilemap)
    5. /// {
    6. ///    IterateTilemapWithAction(tilemap, EraseTilesAction);
    7. /// }
    8. /// void EraseTilesAction(Tilemap tilemap, int gx, int gy)
    9. /// {
    10. ///    tilemap.Erase(gx, gy);
    11. /// }
    12. /// </summary>
    13. /// <param name="tilemap"></param>
    14. /// <param name="action"></param>
    15. static public void IterateTilemapWithAction(Tilemap tilemap, System.Action<Tilemap, int, int, uint> action)
    16. {
    17.     if (tilemap)
    18.         for (int gy = tilemap.MinGridY; gy <= tilemap.MaxGridY; ++gy)
    19.             for (int gx = tilemap.MinGridX; gx <= tilemap.MaxGridX; ++gx)
    20.                 if (action != null) action(tilemap, gx, gy, tilemap.GetTileData(gx, gy));
    21. }
    22.  
    Just a note, the example is just to see how it works, because it would be faster to erase all the tiles with tilemap.ClearMap();

    Basically this methods is a refactorization of an iteration through all the cells in a tilemaps applying an action for each cell.
    You need to create the action as a method with the right parameters.
    There are two versions of actions, one only to iterate through all the cell positions GridX and GridY and the other also get the tileData for each cell:
    System.Action<Tilemap, int, int> action1;
    System.Action<Tilemap, int, int, uint> action2;

    You can see other example of usage in the method CreateTexture2DFromTilemap where it is used to blend the tiles in the output texture.

    Let see another example:
    Code (CSharp):
    1. /// <summary>
    2. /// Swaps a tile for another
    3. /// </summary>      
    4. static public void SwapTile(Tilemap tilemap, int tileId1, int tileId2)
    5. {
    6.     System.Action<Tilemap, int, int, uint> action =
    7.     (Tilemap tmap, int gx, int gy, uint tileData) =>
    8.     {
    9.         int tileId = Tileset.GetTileIdFromTileData(tileData);
    10.         if (tileId == tileId1)
    11.             tmap.SetTileData(gx, gy, tileId2);
    12.     };
    13.     IterateTilemapWithAction(tilemap, action);
    14. }
     
  8. ecesis_llc

    ecesis_llc

    Joined:
    Aug 3, 2015
    Posts:
    58
    I'm trying to use a tile map with 3d colliders. Is it possible to test for a collision using Physics.OverlapBox? If I turn on is trigger testing for collision returns the shared mesh. If I turn off is trigger nothing is hit. Does the 3d collider only work if you have assigned a prefab for a tile in a tileset?

    Collision detection does work how I would expect with Physics2d. Did I miss a step for 3d?

    The image below shows the shared mesh that is hit if trigger is on. If trigger is off the the smaller colliders remain but I don't get a hit with the the overlap. The little white spheres are debugging where the overlap is happening. The tile map collider is set to a layer and the overlap is specifically targeting that layer.

    [Edit]
    I tried used the GetTile method for the tile map. When I select the grid location for that tile (0,5) the collData.type is none. However, the editor shows a collider wire frame for that tile position.

     
    Last edited: Aug 17, 2017
  9. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Well, the colliders in a tilemap should work for all the tiles with colliders even if they have no prefab attached.
    If the tile at position (0, 5) has no colliders, it means you have not set the colliders for that tile in the tile properties window or through the collider edition when the collider tab is selected. So maybe there is the problem.

    Also, the 3D colliders and 2D colliders in mode Edge doesn't trigger a collision inside of the shape. Only in the edges.
    Only 2D colliders in mode Polygon trigger a collision inside of the shape, so maybe this is the difference using 2D colliders.

    I am not sure what you are trying to achieve but maybe checking if the tile has colliders will work the same.

    For example, if you use a Rect instead an overlap box, you could do this:
    Code (CSharp):
    1. /// <summary>
    2. /// Checks if a rect overlaps any tile with colliders
    3. /// </summary>
    4. /// <returns></returns>
    5. static public bool RectOverlap(Tilemap tilemap, Rect rect)
    6. {
    7.     int gridX0 = GetGridX(tilemap, rect.min);
    8.     int gridY0 = GetGridY(tilemap, rect.min);
    9.     int gridX1 = GetGridX(tilemap, rect.max);
    10.     int gridY1 = GetGridY(tilemap, rect.max);
    11.     for(int x = gridX0; x <= gridX1; ++x)
    12.     {
    13.         for(int y = gridY0; y <= gridY1; ++y)
    14.         {
    15.             Tile tile = tilemap.GetTile(x, y);
    16.             if (tile != null && tile.collData.type != eTileCollider.None)
    17.                 return true;
    18.         }
    19.     }
    20.     return false;
    21. }
     
  10. binoculars88

    binoculars88

    Joined:
    Aug 9, 2017
    Posts:
    85
    I just purchased Super Tilemap Editor, so I'm very new to this editor. I wanted to make a simple level based on Kenney's pixel_platform_tileset. Setting things up and creating the level works well, but the moment I try to build it, I get errors, and the build fails:

    Assets/CreativeSpore/SuperTilemapEditor/Extra/Importers/Pyxel Edit/Scripts/AssetDatabaseUtility.cs(1,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?

    Assets/CreativeSpore/SuperTilemapEditor/Extra/Importers/Pyxel Edit/Scripts/PyxelEdit Component/PyxelEdit.cs(23,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?

    Error building Player because scripts had compiler errors

    UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:162
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:83
    UnityEditor.HostView:OnGUI()​

    Things get even weirder when I try to Play after that: the level disappears, and all the referenced scripts "on this Behaviour" are missing.

    Any ideas?

    I'm using Unity 2017.1, on a Mac.
     
    Last edited: Aug 17, 2017
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Remove the Pyxel Edit folder and apply this patch, or just remove the folder if you are not going to use Pyxel Edit. Next version will fix this issue and will be available soon.
     

    Attached Files:

  12. ecesis_llc

    ecesis_llc

    Joined:
    Aug 3, 2015
    Posts:
    58
    The collision detection is testing if a tile is "open" for AStar pathing. That is, there no super tile map collider with a layer of WALL and no unit on the tile. It all worked great with 2d colliders on the tile map. I've swapped everything over to 3d and collision detection does find units on a tile (units have their own colliders) but for some reason the 3d colliders on tiles don't work with Is Trigger off and if I have Is Trigger on it hits the shared mesh and returns a bunch of hits that I don't want.

    The fact that GetTile doesn't return a collider is confusing as I see the collider that the tile map sets up and 3d collider is on for the layer and the tile.

    I'll try a few more things. Due to some interface issues with a mix of 2d colliders, 3d colliders, and mouse events I decided to try setting the colliders on the map to 3d. I was using overlap point for 2d and switched to overlap box/sphere for 3d.
     
    Last edited: Aug 17, 2017
  13. ecesis_llc

    ecesis_llc

    Joined:
    Aug 3, 2015
    Posts:
    58
    So here are some more images. My tile map 3d colliders have no "edge" option in the inspector.

    Here is the overlap test. The vector is the snapped to the tile placement, you can see those little spheres in the screenshots. So the overlap sphere is in the correct location. The layer includes "WallLOS" which the tilemap GO is set to (see image below).

    Code (CSharp):
    1. Collider[] cols = Physics.OverlapSphere(vec, .1f, layer);

    The tile map with 3d colliders used to block astar pathing.



    Test with Is Trigger enabled.



    Test with Is Trigger disabled.

     
  14. ecesis_llc

    ecesis_llc

    Joined:
    Aug 3, 2015
    Posts:
    58
    [EDIT]
    If z axis collision doesn't work with the tile map colliders a solution will be to check the collider using GetTile for tile map collisions and check for units with a physics overlap test. LOS tests should work as they are all on the x,y axes. I'll go this route unless z axis collision should be working with the tile map colliders.

    [OP]
    Ok, I think the issue I'm trying to select a 3d collider by collision through the z axis. Do 3d colliders on the map only have x and y faces?

    If I setup my overlap shape to collide with the edge of a 3d collider through the z axis there are no hits. If I move my shape over a little so the overlap collides on the x,y axis I get hits.

    When using 2d colliders I think this works because I have "Queries start in colliders" enabled in the physcis2d settings. Physics (3d) does not have this setting and enabling "Queries hit backfaces" doesn't change the issues of no hits.

    The reason I was using this method to select was in 2d I could hit tile map colliders and unit colliders with a single overlap call.

    Here is a 2d view of where the overlap selection is hitting a tile.



    A 3d view. The overlap selection should be long enough to collide with the edge of a tile map collider on the z axis but there are no hits.

     
    Last edited: Aug 18, 2017
  15. binoculars88

    binoculars88

    Joined:
    Aug 9, 2017
    Posts:
    85
    Thanks, the errors are gone and I can build the project.

    One thing I still can't figure out:
    Some of my game objects, such as the player, enemies etc., obviously have scripts attached to them. But when building a level using Super Tilemap Editor, the game elements don't become game objects in the Hierarchy, so I can't select one and add a component to it. How do these things work using Super Tilemap Editor?

    Thanks for your fast response and support!
     
    Last edited: Aug 18, 2017
  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    I see. I didn't know about the "Queries start in colliders" option. As far as I know, in 3D, the colliders are created only when needed. For example, if you have a rectangle of 3x3 tiles with full collider rect, only the edges of the 3x3 rectangle will be created. And if you call an pysics.overlap inside the rectangle you won't trigger or get any collision because you are not reaching the walls, unless the overlap shape is big enough. But it is not as easy as make it bigger than a tile because in this case the center tile won't have any collider.

    I was not sure why it was working in 2D with edge colliders. But I guess it because of that option you enabled.

    A way to know if you are inside a shape is by throwing a raycast from the center top vector3.up direction, for example and a distance far enough to go outside the tilemap. Then you can count all the collisions found (with the tilemap) and if the number is odd you are inside a collider, if it is even, you are outside.
    Check this to see how it works:
    http://alienryderflex.com/polygon/

    I wouldn't use is trigger because it needs the collider to be convex and will create new lines in some cases to achieve this.

    I still don't understand why GetTile doesn't return a tile with colliders. If you want to send me a test project I will check that, because I think this would be a better and faster solution for this.
     
  17. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    I guess you mean how to attach a prefab to a tile so when you paint the tile a prefab is instantiated?
    In that case these are the steps:
    1. You have to right click over a tile in the tile palette (this will open the tile property window if not already open)
    2. Select the Prefab tab and drag there the prefab for the tile
    3. Select Display the prefab preview in the tile palette if you want to see the prefab preview instead of the tile
    Now when you paint that tile, a new instance will be created as children of the tilemap.
    If you want to use the same prefab for several tiles and the only thing that changes is the shape, attach the component TileObjectBehaviour to the tile so when you paint this prefab it looks like the tile used to paint it.
     
  18. Grandy12

    Grandy12

    Joined:
    Apr 22, 2016
    Posts:
    3
    Hey man, is there any way to pause an animation made with an animation brush? We sort of want to make a time stop effect to the game
     
  19. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    You can change the AnimBrush.cs file to take into account the Time.scale.
    upload_2017-8-28_12-8-17.png
    In the marked line, multiply Time.scale to Time.realtimeSinceStartup
     
  20. geronika2004

    geronika2004

    Joined:
    Sep 16, 2009
    Posts:
    24
    Hi :), excellent tool, how about vertex lights, when it is possible to use them and dynamically move lights in scene.
     
    Voodoo_ZA likes this.
  21. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    You can use lights if you change the material of a tilemap, for example, to Sprites/Diffuse.
    Also, you can change the vertex color for each tile in the tilemap using the method Tilemap.SetTileColor.
    To make it easy to paint the vertices I am working on a Color vertex painter, but it is still WIP.
     
  22. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    Hi, I just purchased the asset, created a simple tilemap using Tiled, save it in XML format, and tried to import it as instructed in the manual. It throwed the following exception:

    Assertion failed: Assertion failed on expression: '!(o->TestHideFlag(Object::kDontSaveInEditor) && (options & kAllowDontSaveObjectsToBePersistent) == 0)'
    UnityEditor.AssetDatabase:CreateAsset(Object, String)
    CreativeSpore.TiledImporter.TmxImporter:CreateTilesetFromTmx(String, String) (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/TiledImporter/Editor/TmxImporter.cs:65)
    CreativeSpore.TiledImporter.TmxImporter:CreateTilesetFromTmx() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/TiledImporter/Editor/TmxImporter.cs:35)

    I am using Unity 2017.1 and Windows 10. Can someone please help. Thanks.
     
    Last edited: Aug 30, 2017
  23. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Hi!
    It looks like one of the bugs appeared with Unity 2017. Probably it is fixed in the last version.
    Anyway, it is just a warning, shouldn't be affecting the final process. Did you get the tileset imported from tiled?
     
  24. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    Hi @CreativeSpore Unfortunately, the exception is severe enough to prevent Unity from actually importing the tilemap. I have the latest version of Unity 2017.1 and just reinstalled it. The result is still the same. I'll try again when Unity has a new update.

    One reason I tried to import from Tiled is because I need multiple layers, and I can do it easily in Tiled. I haven't figure out how to do multiple layers inside super tilemap editor. I was hoping that the import will automatically create the layers for me. Now that the import approach is bugged. Can you explain how to do multiple layers directly inside super tilemap editor? Thanks.
     
  25. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    I have attached a patch to avoid the warning. I have also test it before fixing it and the tileset was being created (using 2017.2.0b8 and the desert.tmx file included in the samples). So maybe there is something wrong with the tmx you were trying to import, but anyway try again after applying this patch.

    About your question, it's really easy to use layers in STE, but here a layer is a tilemap managed by a TilemapGroup.

    upload_2017-9-1_11-16-25.png

    upload_2017-9-1_11-20-32.png
     

    Attached Files:

  26. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    @CreativeSpore Import works after patching (still using the latest version of 2017.1)
    Thanks for the instructions on creating multiple layers.

    The tool STE is great, keep up the work.
     
    Last edited: Sep 1, 2017
  27. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    19
    Hello!

    Just a quick question - I'm making procedurally generated maps with this, and I want to be able to get the specific uvs of a tile that's been drawn on a tilemap with a brush. I haven't quite found a way to do this - I tried using Tile.GetTile() but that doesn't give me the actual tileId that's been drawn by the brush, only the tileID that's been defined in the TileData for that grid position.

    Any help here would be great!
     
    Last edited: Sep 2, 2017
  28. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Use the method GetTile from the tilemap component:
    ex: Tile tile = tilemap.GetTile(4, 5);
     
  29. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    19
    Hello! I wonder if I have come across a bug here?

    At the top of my script I'm setting up two new TileDatas, visWallTiles and visFloorTiles. Then I am doing the following in the Start() function:

    visWallTiles.tileId = 3;
    visWallTiles.brushId = 6;
    visFloorTiles.tileId = 15;
    visFloorTiles.brushId = 3;

    ...and then using SetTileData to place visWallTiles or visFloorTiles depending on the procedural layout.

    If I later do the following:

    Tile tile = ProceduralTileMap.GetTile (x,y);

    The returned 'tile' will never be the tile that is drawn/placed by the brush (which is what I want to find out), but the tileId, which will either be 3 or 15 depending if it's the floor or wall.

    If I comment out visWallTiles.tileId = 3; and visFloorTiles.tileId = 15; then UpdateMesh will draw nothing at all, and I will get the following error if trying to look at the tile.uv after using GetTile:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Rect.get_x () (at C:/buildslave/unity/build/Runtime/Export/Rect.cs:52)

    I assume this is intended behavior, as brushes and tiles are sort of separate things, but there must be a way to find out what specific tile (or the uvs that are being referenced in the texture) where a brush has painted something using custom-defined TileData.

    Thanks for your help!
     
  30. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    How do you use SetTileData? are you using grid positions or local position?
    A common mistake is call SetTileData using a local position and get the tile using a grid position.

    This is how the brushes work:
    When you update the tilemap, all the tiles with a brush will ask the brush for the tileId and modify the tileId of the tile data and will set the flag k_TileFlag_Updated = 0x10000000, so the next time the tileId won't be changed (for example a RandomBrush won't change the tileId each time you update the tilemap).
    But if you refresh the tilemap, calling the Refresh method or pressing F5 or pressing the refresh button, all the brushes will be invalidated and the tileId will be changed.

    So, you should get the tile at (x, y) position once you have updated the tilemap.

    Another thing that could be happening. For performance, if you call tilemap.UpdateMesh() it won't update the tilemap until the next Update. But if in your case you are setting both, the brushId and tileId it should return the right tile.
    If you only set the brushId, to calculate and set the tileId immediately call tilemap.UpdateMeshImmediate().
     
  31. JaseofBase

    JaseofBase

    Joined:
    Jun 12, 2017
    Posts:
    14
    What would be the best way to set the sorting order of a tile dependant on where the player is? I can do this with my active characters but trying to incorporate this dynamically with the tilemap is proving difficult, unless i'm missing something.

    Essentially if the player is currently a lower Y pos then the tile, it needs to draw the tile behindof the player, and if the player is a higher Y pos it draws infront. I'm not sure what part of the tilemap I need to reference to let me do this without changing the whole tilemap at once.

    Cheers :)
     
  32. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    19
    Thanks for the information! UpdateMeshImmediate() did the trick :)
     
    CreativeSpore likes this.
  33. Ericks89

    Ericks89

    Joined:
    Nov 3, 2012
    Posts:
    39
    I probably missed it within the 17 pages, but does this offer sub division tile mapping?
    I saw another asset had it but hasn't been updated since 2015.
     
  34. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Sorry I didn't answer before. I didn't receive any email about new posts in the thread as usual.
    You cannot change the tile position without changing the code.
    But in most of the cases you could do the trick if you use a different tilemap for tiles that are supposed to be over the ground level, like the top of a tree, and another one for the ground or bottom of trees, walls, etc.
    This is tricky indeed. For example if you have a palm tree, 1x3 tiles long, and you sort each tile depending on the player position, in the middle, you will see it is under the top tiles but above the bottom tile.
    Something like this:

    (In fact, it's just the opposite of this image. The base will be over the bottom part and the top tile under it.)

    So at the end, it doesn't matter if you manage to sort each tile by Y position, you will need to make your map and game design to avoid these situations. In the above case, it is fixed not allowing the player to move over the bottom tile, increasing the foot collider, and all the tiles of the plant over the base can be over the player, using a different layer, but making sure the player is not tall enough to overlap the above tiles when it is placed under the plant base.

    Options two, you can paint these elements using a sprite. With STE you can create a prefab with a group of tiles or even better, slice the atlas if you have no padding between the tiles, and create a prefab with that sprite and attach the prefab to any tile of the tileset. This way, the plan would be placed as a gameObject where you can attach any sorting script.
     
    JaseofBase likes this.
  35. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Do you mean subdividing a tile in 4 small tiles, mostly for autotiling?
    Yes, it is allowed, and some brushes use it, like CarpetBrush and A2x2 Brush.
     
  36. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    New version of Super Tilemap Editor released!

    Changelog v1.4.3.8
    • Added GetTileFlagsFromTileData to Tileset class
    • Added Atlas Creator Window (menu->SuperTilemapEditor->Window) (to create an atlas using a collection of tile textures)
    • Added randomize pattern option to drawing tools
    • Added another method for drawing methods to use grid positions
    • Added randomize pattern option to TilemapDrawingUtils.FloodFill
    • Added support to import Tiled tilesets made of a collection of sprites
    • Changed Tilemap.SetMapBounds and MinMaxGridXY parameters are now read-only
    • Changed tilemap chunk renderer properties has been moved to a class (NOTE: these properties will be reset for all tilemaps created in previous versions)
    • Moved FindDefaultSpritematerial method to TilemapUtils
    • Fixed assert warning while importing a Tiled tmx in Unity 2017
    • Fixed tilemap tint color was set to default (0, 0, 0, 0) when a tilemap was being created in game
    • Fixed when a prefab is instantiated by a tile, the Z position remains with the same value set in the prefab (this was previously fixed but taking the instance Z position instead of the prefab Z position)
     
  37. Ericks89

    Ericks89

    Joined:
    Nov 3, 2012
    Posts:
    39
    Kind of, think of the tile size as 16x16 I would like to place 8x8 tiles in certain areas and keep some things such as flowers as close together without having to create a flower object.

    Otherwise if it allows different tilesets per layer "maybe even different tile sizes per layer" that would also work.

    I also purchased the asset because of the TileD TMX support :)
     
    Last edited: Sep 12, 2017
  38. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Yes, you can use different tile sizes per layer. Or use a different tileset to keep the pixel size ratio.
    Thanks for purchasing STE ;)
     
  39. JaseofBase

    JaseofBase

    Joined:
    Jun 12, 2017
    Posts:
    14
    Hey man, Yea that's what I figured. I'm trying something a little unorthodox for the typical genre use of tilemaps so i'm having to get real fancy with the spices to pull it off.

    I've currently got layers set up like that for what i'm working on. I might have to adapt my sorting code with some sort of compensation so it works for both. I'll get back to you when I figure it out. Cheers for the heads up!
     
  40. JaseofBase

    JaseofBase

    Joined:
    Jun 12, 2017
    Posts:
    14
    Any reason you set the Tilemap.SetMapBounds and MinMaxGrids to be read only. Does this mean I'll no longer be able to automate tilemaps to size dependant on another tilemap?

    This is kinda crucial for me. Cheers
     
  41. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    I don't know why I wrote that. It should be:
    - MinMaxGridXY parameters are not read-only, now you have to call SetMapBounds to change the map bounds.
    It's just to make sure RecalculateMapBounds is called after changing the map bounds.
     
  42. Ericks89

    Ericks89

    Joined:
    Nov 3, 2012
    Posts:
    39
    At work, (yet can use Unity on the machine), your sites block :(
    how would you check for tiles that do not have any tile colliders? As I have a variable in my character controller named touching, and tiles with no colliders will be used as ground. "I have a ledge jump feature and it makes it easier to stop movement if touching = "ground" ".
     
  43. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I have a stupid question. Can STE work on a 2.5D game?
     
  44. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    You can check if a tilemap position contains a tile with colliders like this:

    Option 1: using grid position like (4, 6)

    Tile tile = tilemap.GetTile(4, 6);
    if(tile != null && tile.collData.type != eTileCollider.None)
    {
    ... the tile at (4, 6) has colliders
    }
    else
    {
    ..it doesn't have colliders
    }

    Option 2: using a world position, like player.transform.position:
    Tile tile = tilemap.GetTile(player.transform.position);
    (the rest is just the same)
     
  45. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    I didn't try, but it should be possible.
    You can use 3D tiles using a prefab attached to a tile in the tile palette. Also, if you want the colliders to be generated by STE, you can attach colliders to the tiles and use 3D colliders with a proper deph for the ground.
     
  46. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hey man,

    I finally started to work with STE. It's going to be a 2D Platformer using STE, Corgi & PlayMaker.

    So right now I'm looking into how to combine all of them together and make something work.

    I have some stupid questions:

    1. I'm using a TilemapGroup. I think it's better to organize myself. Having Backgrounds on one Group, normal Tiles on another, etc. Is it ok & encouraged to have 2-3 Tilesets? I would like to organize myself better then just have a huge tileset atlas like the Kenney one. Even that ye, I know that you can have a Tileset View and only show parts of the whole atlas.

    2.
    Another thing that I'm trying to do is "paint" some interactible objects with the tilemap editor. I saw that you can instantiate a "prefab" in the Tile Properties:


    I was also able to code some "logic" using Playmaker and when my player walks into that prefab, it destroy itself. So that's pretty cool.

    So this way I can prepare my animated prefabs ... like spinning coins, etc as prefabs, and then just "paint" them using the tilemap editor. Besides the coins I also plan to do some traps, spikes and other interactible objects.

    So is this tactic encouraged or you know of a better system to do this? I think that the only objects that will not be painted with the TilemapEditor would be Corgi's moving platforms. Havn't got to that part yet so I'm not sure how that will work.

    Well... this is it so far...

    Thanks <3

    EDIT:

    I want to have a tile, that when the player walks on that tile, to "do something". That something would be to change the speed of the player.

    How would you attach some "code" to a particular tile?
     
    Last edited: Sep 21, 2017
  47. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    Hi GamerPET,
    It's good to know you started a game with STE.
    For your information, I am working on a new asset with Playmaker actions for STE. I hope it will be available soon, and you would be able to use Playmaker also to interact with the tilemaps.

    About your questions, I don't think they are stupid ;)

    1. I'm using a TilemapGroup. I think it's better to organize myself. Having Backgrounds on one Group, normal Tiles on another, etc. Is it ok & encouraged to have 2-3 Tilesets? I would like to organize myself better then just have a huge tileset atlas like the Kenney one. Even that ye, I know that you can have a Tileset View and only show parts of the whole atlas.
    About organization, I always using a tilemap group for all the tilemaps (they are like layers, but I decided it was better this way for design and usability). You can use the highlight option to highlight the selected tilemap.
    upload_2017-9-22_10-30-31.png
    About using different tilesets. The only concern here is, Unity will use a draw call for each texture change, so you could miss the batching here. This could be a problem in Mobiles more than in PC or Consoles, but it's something to be taking into account. Probably, if the amount of tiles in the screen is not big, you will still have few drawcalls.
    But you can still use the tileviews. You can make a tileview from a tile palette selection but also, you can draw in a tilemap a bunch of tiles, select them and create a tileview from that selection. It's really useful in some cases.
    At the end, when you have a level with some tiles you will end by picking up the tiles in the tilemap more than taking them from the tile palette.

    2. About using prefabs attached to tiles for level edition.
    This is totally a good solution. I use also this method to add instances in the level with special behaviour like the player, enemies, npcs, chest, doors, traps, etc. Again, take into account, this way you create a gameobject per tile, so if you attach a prefab to every tile in the level, it could create so many objects. Use it with wisely.
    A tip for this.
    You can use the component TileObjectBehaviour to replicate the tile where it is attached to. For example, you have a script to manage a door or a chest, it's the same script for a different doors and chests you have in a tileset. You only need to add the TileObjectBehaviour and the DoorBehaviour or ChestBehaviour to a prefab so you can use the same prefab for the same kind of tiles.
    Also, if you check the TileObjectBehaviour, you will see it receives a message when it is instantiated. You can create your own modified TileObjectbehaviour to take, for example, a tile parameter to set some values. In case of traps, you can use this to set the amount of damage, or for a door, the key used to open it.

    3. I want to have a tile, that when the player walks on that tile, to "do something". That something would be to change the speed of the player.
    I would do this in the opposite way. The player could check if it is over an specific tile to slow down the player movement.
    You can check the tile under the player like this:
    Tile tile = tilemap.GetTile(player.transform.position); // tilemap would be a reference to the tilemap behaviour
     
  48. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks for the replay.

    1. I understand about having multiple atlases and Unity using a draw call for each. It's ok... it's a PC game and I only plan to have between 1 and 3. And who knows, in the end I might even put all of them in one.

    2. Again, take into account, this way you create a gameobject per tile, so if you attach a prefab to every tile in the level, it could create so many objects. Use it with wisely.

    I'm a bit confused here. Or partially confused. I will only attach prefabs where I want to have a trap, enemy or anyting that requires some behaviour. Not sure if this would be to probelmatic since if I don't use it like this, I will have to manually place those objects anyway. I might later split the level into multiple scenes and load them async so I'm not to concered about this. First time I read your message I understood that if I attach an prefab to a tile, it will be created to all the tiles, or something like that :)

    But I think I might understand what you say with TileObjectBehaviour. What you say is... let's say I have 3 tiles in a row that have an indentical behaviour. Normally, I will isntantiate 3 prefabs for each tile. You are suggestion to look into TileObjectBehaviour so I don't have to instantiate 3 prefabs... right? (I still have to look exactly what TOB is doing and how).

    3. Good point. I still have to see how to make all those components speak. I'm using Corgi so I can't modify that to much because I don't know how, but my main player has my own script, so maybe I can do some checks there.


    P.S. I'm happy that you are making PlayMaker actions since I love playmaker, however for this project I moved to FlowCanvas. Maybe you can look into that too? It's a bit easier to create some stuff especially when you need a flow, and I do need a flow here.

    Thank You for your answers!
     
  49. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,123
    About the second point, I was just warning about not abusing of this feature for performance reasons. But in your case it will be ok. You are using it wisely ;)

    About TileObjectBahaviour in detail:
    • It is attaching a SpriteRenderer component to the gameObject if not already added.
    • When a tilemap is about to instantiate a prefab, it sends a message to any script attached to the prefab "OnTilePrefabCreation". You have more information in the manual: "7.3 TileObjectBehaviour and OnTilePrefabCreation event"
    • Then, this script is using this message to create an sprite with the tile that is instantiating it.
    You can use also this message to add custom behaviour depending on the tile or tile parameters.
    For example, this is the TileObjectBehaviour modified to change the health of a HealthBehaviour attached to the prefab:
    upload_2017-9-25_13-48-0.png

    In this example I have modified the TileObjectBehaviour, but you should create your own custom behaviour to keep the default behaviour available.

    Thanks for telling me about FlowCanvas, I will have a look into it.
     
    GamerPET likes this.
  50. Velcrohead

    Velcrohead

    Joined:
    Apr 26, 2014
    Posts:
    72
    Hi CreativeSpore, a couple of questions about STE.

    Does it support setting the tiles through procedural generation?
    How many tiles can be supported at once?

    I don't suppose there is a demo version I would be able to try to see if this suits my needs?

    Thanks in advance, looks like a great asset :)
     
unityunity