Search Unity

[RELEASED] Super Tilemap Editor

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

  1. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Because the X is increased in the first iteration before invoking the event. But the first output should be fine. Did you find any issue because of this?
     
  2. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    40
    None, just wanted to better understand your design.
     
  3. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    I've hit an issue using the CarpetBrush that I didn't see until I started putting in some placeholder art.

    It seems that unlike a RoadBrush, the CarpetBrush doesn't account for rotation of the center tile if you place it Above/Below.

    Here's an example:
    https://gyazo.com/8b45a40a3393da65cd6e07e2a480c8ce

    As you can see, the tile chunks (using CarpetBrush of 9x9) running left/right are correct. The center tile (connecting wooden boards) are facing the left/right direction so they connect seamlessly.

    When running up/down, the center tile is still facing left/right, but it should be facing up/down.

    Is there a way to fix this?
    Its almost like I need a combination of a CarpetBrush and RoadBrush.
     
  4. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    40
    Few more questions for ya! Thank you for being accessible.

    #1 - How come draw dot (PM action) doesn't let me pass brush ID, tile ID, etc, from my Get Tile Data PM action? Is there a PM action that lets me set tile data? Because I don't see a PM action called Set Tile or Set Tile Data.

    #2 - In the image I am about to show, why is it that only the third action works to refresh the tilemap and show my changes? (I made changes by using a "Call Method" action to bypass #1's problem, but I would still like to know a better way of doing #1): (green worked, red didn't. I tried them on different states too): https://i.imgur.com/dV9ZDUi.png
     
  5. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Can you send me the tileset and brush to check it? I am not sure why it is not working. But I've seen in the past the Carpet Brush could need an extra parameter to manage with the center tile in some cases. Maybe this is one of those cases and I could add an special mode to manage this case. But I would need to test it myself.
     
  6. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there!

    I have added the SetTileData action to pass a tileId, brushId and tileFlags. Check the attached package.
    For the second question, I tested the UpdateMesh action and it worked fine for me. Its faster if you call UpdateMesh because it will wait until the tilemap is updated to update the mesh at once with all the changes done.
    Maybe it is failing because GroundTilemap2 is not pointing to the World tilemap.
     

    Attached Files:

  7. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Sure! CarpetBrush and the tileset are actually just from your Roguelike example. I only modified the tileset dirt pieces visually (attached).

    I am using "CarpetBrush1" from 'Kenney's Rogue Like > Brushes'
     

    Attached Files:

  8. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Ok, now I see the problem. You forgot to change the 4 interior corner tiles for the brush:
    upload_2018-4-28_14-4-46.png

    You can double click over a brush to display the brush inspector (or select the brush asset), and you will see what tiles you missed to change.
     
  9. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    That's a different problem (that I need to correct changing the 4 interior corner tiles, I do see I missed those tiles in the spritesheet), but its not actually the cause of the main issue:

    The center tile still needs to rotate its orientation when the tile connects at the top or the bottom of another tile of the same.


    Right now, regardless if the tile is connecting to another going left/right or up/down, it is always oriented in the direction that is in the sprite sheet (left/right). I need it to rotate up/down when it connects above or below another tile.

    Hope that makes sense!
     
    Last edited: Apr 28, 2018
  10. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Thanks for the clarification, I wasn't sure what you wanted to say about the rotation.
    The way the Carpet and Road brush work is by checking the neighbor tiles around (only top, right, left and bottom tiles). It means that the center tile will be considered the same if it is in a vertical or horizontal row.
    You can modify the code (or create a different version) to make what you want.
    Once the tile is considered a center tile (s_neighIdx == 15) you can make an extra check to see if 2 tiles to the right and 2 tiles to the left and not autotiling with the brush.
    Code (CSharp):
    1. if(s_neighIdx == 15)
    2. {
    3.     if (!AutotileWith(tilemap, s_brushId, gridX + 2, gridY) && !!AutotileWith(tilemap, s_brushId, gridX - 2, gridY))
    4.     {
    5.         //rotate the tile 90 degrees
    6.         tileData |= Tileset.k_TileFlag_Rot90;
    7.     }
    8. }
    9.  
    upload_2018-4-29_10-28-59.png
     
  11. SHIBAPOWER

    SHIBAPOWER

    Joined:
    Oct 16, 2012
    Posts:
    18
    Excuse me, I can not upgrade my project to Unity 5.x or above, Does has any possible that Super Tiled Editor also compatible to 4.7?
     
  12. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there!

    I tried to fix the compilation errors to see if it was possible to make it compatible before answering you, but I found to many incompatibilities. I stopped when I found Unity 4.7 doesn't have the Camera onPrecull and onRender events (not as easy to fix with a work around like the missing Debug.Assert method).
    I'm afraid it won't be easy to make it compatible with unity 4.7.
     
  13. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    It seems like if I paint a RoadBrush over a CarpetBrush area, the CarpetBrush has some weird autotiling with it. I've set both brushes for Autotile to Self (no groups).

    When I place the RoadBrush anywhere other than where the CarpetBrush is, it works as expected:

    (Correct)


    (Correct)


    But, when I place the RoadBrush on top of where a CarpetBrush is, it does something strange:


    Both Brushes are set to only autotile with themselves.

    CarpetBrush:


    RoadBrush:


    Group Settings:


    What is causing this? It looks like some random auto-tiling that doesn't seem possible.
     
    Last edited: May 4, 2018
  14. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Also, would you mind making a custom Playmaker action for TilemapUtils method GetGridPosition? :)
    It is one I use extensively (to determine where the Cursor Box is on the map grid so I know to paint a tile in that spot during runtime) and calling methods in Playmaker can be performance expensive.

     
    Last edited: May 4, 2018
  15. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    Hi there,
    I have a weird bug in Unity 2018.1.0f2. Editor just disappear(no ui in top left corner of scene view) and I can't draw anything. Brush is snapping to origin of tilemap and I can't move it. This bug happened once in betas but it solved somehow by itself. Now this bug back again. Also I got no errors in the console...
     
    Last edited: May 4, 2018
  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi Tim!
    I have downloaded the same version and imported the last version of STME, but I found no issues.
    I have notice that Unity doesn't import the assets properly if you are not importing them as a package.
    For example, I am working in an asset in Unity 5.3 and I was testing it in Unity 2017. Normally I create a package and import it in Unity2017, but once I decided to just drag the tool folder from Unity 5.3 folder to Unity 2017 folder and some data was missing in the asset importation. It's weird, but I always create a package now when I want to import something in Unity 2017.
    I suppose this could have happened to you, maybe you have opened the project with a newer version and something is missing during the import. Try creating a package with a previous version and importing it as a package.
    Something that works as well is a hard reset by removing the Library folder in the root folder (with the project closed) and opening it again, forcing to import everything again.
     
  17. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    You can also use local positions in any tilemap painting actions so you don't need to calculate the grid position.
    In the Fog of War demo example you can see an example of this method:
    upload_2018-5-4_12-39-48.png
     
  18. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    One thing that could be causing this is, the inner tiles. The border should be open, not closed:
    upload_2018-5-4_12-45-57.png
     

    Attached Files:

  19. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    Yes, this happened after I update Unity from 2018.1.0f1 to 2018.1.0f2. I tried to delete and reimport STE, delete Library folder from root, but none of this is help :(
     
  20. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Maybe the project got corrupted. Are you using a version control tool to revert the changes?
    How are you reimporting STE? Are you using the store package? In my test I have just import the same package that is crated before it is submitted to the store. And it was working fine. It could be also any other script or asset in your project that is causing the issue. Can you post the console log with the errors?
     
  21. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    I'm using Unity Collab.
    I close project, delete STE folder, open project and import it from store.
    This is the thing, there is no errors in console log at all.

    I just tried to update another my project from 2018.1.0f1 to 2018.1.0f2. And there everything is working fine...
    I will try to redownload project from Collab.
     
  22. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Could you send me a test project? I have tested the Roguelike and Platformer demo and they worked fine. Maybe it is related with something not affecting the demo examples.
    I am also using Windows, maybe it is related with the OS.
    And I am using a PC, Mac & Linux Standalone target.
    If you create a new project and import STE is it working fine with the demo scenes?
    If you don't mind, you can send me a test project to check it myself.
     
  23. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    I figured it out. This is was editor layout bug. I just reset it to default.
    This is strange, for example, ProGrid does not have a bug like this, so it would be great if you look into this.

    I still have this buggy layout saved, so if you need this just say

    Edit: I'm on MacOS High Sierra by the way
     
    CreativeSpore likes this.
  24. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Yes, please. Send me the layout. I would like to have a look into it.
     
  25. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    Here you go.
     

    Attached Files:

    CreativeSpore likes this.
  26. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    I made some research and found this:
    https://answers.unity.com/questions/1418211/onscenegui-not-called.html

    It looks OnSceneGUI is called only for the first Inspector window and in your layout you have two, one for Quality Settings and other for the selected gameObject. I couldn't found a way to fix it yet. There is no much information about this bug.
    Using reflection I found out that OnSceneGUI is called only for the active Inspectors, and in the broken layout, only the Quality Settings editor is active, not the gameObject editor. This is the code I used to debug the active editors with each layout:
    Code (CSharp):
    1.  
    2. if (GUILayout.Button("Display Active Editors"))
    3. {
    4.     MethodInfo methodInfo = typeof(SceneView).GetMethod("GetActiveEditors", BindingFlags.NonPublic | BindingFlags.Instance);
    5.     if (methodInfo != null)
    6.     {
    7.         Editor[] editors = methodInfo.Invoke(SceneView.sceneViews[0], null) as Editor[];
    8.  
    9.         foreach (Editor editor in editors)
    10.         {
    11.             Debug.Log(editor + " target " + editor.target);
    12.         }
    13.     }
    14. }
    I don't know how ProGrid works, maybe they found a work around or they are not using OnSceneGUI to work.

    Right now, the best solution is, closing all extra inspector windows and reopen the project.
     
    SugoiDev likes this.
  27. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    Wow, it's good to know. Thank you for your time and help, because this issue drives me crazy for last two days.
     
  28. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    In fact, it is also affecting Unity components like PolygonCollider2D. You won't be able to editor the polygon nodes with your broken layout, for example. I guess Unity will fix it in new versions.
     
  29. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    96
    You just saved me a lot of time. I'm always edit polygon collider manually in array and couldn't figure out why this didn't work.
     
    CreativeSpore likes this.
  30. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Thanks!
     
    Last edited: May 9, 2018
    CreativeSpore likes this.
  31. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Yesterday I bought Super Tilemap Editor and I'm very happy with this asset, I began to read the whole manual (I still have to read some pages) and now I'm reading the whole forum. I currently need to look for information to:
    1- Small and basic procedural Map (20x20). Maybe in playmaker? (but I also have knowledge of c#) ... I would like to understand what I am doing so I can make more complex maps.

    2- Sorting layer For the player. I made Player Controller tutorials in RPG and it have a script that updates the layer order of the player. Here I have to do something different?

    3- Pathfinder for enemies

    Where can I find some information about this? I would only like an orientation, it is not necessary for you to explain me in detail. Thank you very much for this tool.
     
    Last edited: May 11, 2018
    CreativeSpore likes this.
  32. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there!
    I'm glad to know that you are happy with this asset ;)
    About your questions:

    1- Small and basic procedural Map (20x20). Maybe in playmaker? (but I also have knowledge of c#) ... I would like to understand what I am doing so I can make more complex maps.
    You can start with the RoguelikeDemo Scene. It has a demo of a procedural generated world, using two tilemaps, for ground and ground overlay. The script is attached to the Tilemap gameObject and it's called RogueLikeMapGenerator. It uses perlin noise to generate the map tile by tile.
    To know more about how to generate a tilemap by script, check these tutorials:
    https://creativespore.com/category/tutorialsupertilemapeditor/

    2- Sorting layer For the player. I made Player Controller tutorials in RPG and it have a script that updates the layer order of the player. Here I have to do something different?
    No, you can use the same approach. I also use a sorting layer for the game actors, like player, enemies, etc, and change the sorting order according to the Y position.
    You can use a different sorting layer for the tilemaps, like Ground (below actors), Isometric (for actors) and Overlay (above the actors), for example.

    3- Pathfinder for enemies
    You can use the included path finding system. In the RoguelikeDemo demo you have another example of use in the PathfindingBehaviour gameObject, using the PathfindingBehaviour script.

    If you need help after checking this information, don't hesitate to ask.
     
    gferrari likes this.
  33. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    @CreativeSpore
    Hi sir, I was planning on purchasing your asset, but i noticed something, it looks like it only works on the sprites and splits them itself ? what i am after is the ability of adding some prefabs as tile sets and brush them on the map because some of the tiles i need to use in my game will have few scripts attached to them and not being able to utilize a prefab is a huge headache for me
     
  34. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there!
    You can attach a prefab to any tile and decide if you want to display the tile or hide it.
    To do it, right click over a tile to display the Tile Properties Window.
    Drag a prefab to the prefab property.

    upload_2018-5-13_10-16-54.png
     
    gferrari likes this.
  35. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Greate, Thanks sir

    one extra question, the assets i am using does not have sprite sheets but each asset is it's own file, how would i start the generation of the tile set? all the videos i saw on youtube about your asset starts with a sprite sheet and crops different assets from them first.
     
  36. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Use the Atlas Creator Window:
    upload_2018-5-14_20-6-43.png

    1. First, create a tileset or select one.
    2. Then, drag all the tiles to the Tile Textures array.
    3. (Optionally) Press Sort By Name, to make sure the tiles are sorted in case you want to add more tiles later, to keep the same order and make previous tilemaps compatible with the new tileset.
    4. Press Create Atlas & update Tileset.
    upload_2018-5-14_20-7-36.png
     

    Attached Files:

    Jiraiyah likes this.
  37. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Just a heads up for anyone interested - A* Pathfinding Project works well with Super Tilemap Editor. The main thing is you must set all of your tile collisions to Polygonal - "Full" doesn't work.
     
    CreativeSpore likes this.
  38. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Thanks for telling about this.
    But I didn't understand that Full doesn't work. It should work, in fact, there is an optimization that changes the tile collide type to full if the 4 vertices are in the corners.
     
  39. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    ummm, did you try importing your package into unity 2018? i get this error while importing it :
    Code (CSharp):
    1. APIUpdater encountered some issues and was not able to finish.
    2.  
    3.  
    4.     System.ArgumentException: preprocessorSymbols
    5.       at Microsoft.CodeAnalysis.CSharp.CSharpParseOptions..ctor (Microsoft.CodeAnalysis.CSharp.LanguageVersion languageVersion, Microsoft.CodeAnalysis.DocumentationMode documentationMode, Microsoft.CodeAnalysis.SourceCodeKind kind, System.Collections.Generic.IEnumerable`1[T] preprocessorSymbols) [0x00051] in <8d5a2b6695c6475bb1cb5b9a9f9c8dd7>:0
    6.       at CSharpUpdater.CSharpUpdater.ParseSyntaxTrees (APIUpdater.Framework.Core.SourceFile[] inputs, APIUpdater.Framework.Core.UpdaterParameters parameters) [0x00018] in <a746af91eb4946abb01fd402ed659b74>:0
    7.       at CSharpUpdater.CSharpUpdater.RunUpdater (APIUpdater.Framework.Core.SourceFile[] inputs, APIUpdater.Framework.Core.UpdaterParameters parameters) [0x00013] in <a746af91eb4946abb01fd402ed659b74>:0
    8.       at APIUpdater.Framework.Core.APIUpdaterBase.Update (APIUpdater.Framework.Core.SourceFile[] inputs, APIUpdater.Framework.Core.UpdaterParameters parameters) [0x0002a] in <3aa0dc9631894fbf9d7fb1f0bec9753b>:0
    9.       at ScriptUpdater.Program.UpdateLanguage (APIUpdater.Framework.Core.IScriptUpdater updater, APIUpdater.Framework.Configuration.CompilerResponseFile responseFile, System.String unityDataPath, System.String outputPath) [0x00083] in <5fbd3d45536c4995a0f985f31cf4fb54>:0
    10.       at ScriptUpdater.Program.Main (System.String[] args) [0x000c4] in <5fbd3d45536c4995a0f985f31cf4fb54>:0
    11.  
    and i don't see any menu at all

    never mind, got it working
     
    CreativeSpore likes this.
  40. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Hello I have this error, look for a tileset that I do not have, is there any way to prevent it from appearing? The game works and has no problems. But I do not like the error: P

    Thanks!

    upload_2018-5-18_1-53-24.png
     
  41. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    I have created a patch to remove the invalid tiles in a tilemap. Let me know if the problem was fixed.
    Make a backup before applying the patch, just in case.
     

    Attached Files:

    gferrari likes this.
  42. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Never! I like the adrenaline. I'm kidding, I already make a backup. Thank you very much!

    I have this "warning" But it is better than the red error, at least now it does not bother me

    Background2\-1_0: TileId 42 not found! GridPos(57,4) tilaData 0x2A
    UnityEngine.Debug:LogWarning(Object)
    CreativeSpore.SuperTilemapEditor.TilemapChunk:FillMeshData() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/TilemapChunk_Renderer.cs:347)
    CreativeSpore.SuperTilemapEditor.TilemapChunk:UpdateMesh() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/TilemapChunk_Renderer.cs:158)
    CreativeSpore.SuperTilemapEditor.STETilemap:UpdateMeshImmediate() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/STETilemap.cs:1092)
    CreativeSpore.SuperTilemapEditor.STETilemap:Update() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/STETilemap.cs:432)
     
    Last edited: May 21, 2018
  43. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    The warning should appear only once. After that, the missing tileId is removed from the tilemap and shouldn't appear anymore.
     
    gferrari likes this.
  44. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    There was a small bug in the previous patch when a brush was being selected. I have updated it.
     

    Attached Files:

  45. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Hello! me again, I hope not to disturb. I am very happy with the asset and it works very well!. I managed to make the pathfinder work, it just does not reach the limits of the map. It's like taking polygons colliders as a whole block. Is there any way to make it more accurate?
    I show you the configuration that I have.

    upload_2018-5-23_0-51-40.png
    upload_2018-5-23_1-1-56.png upload_2018-5-23_1-2-26.png
     
  46. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    The pathfinding is only considering passable tiles without any collider.
    You can change the IsPassable method here:
    upload_2018-5-23_9-45-47.png

    A way to do this could be using a halved cell size and checking not just if the tile has a colider but if the center of the cell is inside the tile collider area.
     
    gferrari likes this.
  47. gwigz

    gwigz

    Joined:
    Apr 29, 2017
    Posts:
    1
    What is the least destructive way to handle making changes to tilesets, say for example you need to adjust the size to add more tiles or move tiles around and reimport, I'm thinking maybe using the atlas feature?
     
  48. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    If you slice the tileset atlas using the tileset inspector, you can keep the the compatibility and the tile properties if you only increase the atlas texture height, not the width.
    Using the Atlas Window, you can achieve the same if you name the tile textures in order and add the tiles always sorted by name.
     
  49. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Hello - I'm evaluating this asset for the first time.. you have probably already answered this, but can you please clarify something: Can you use the Unity lighting system on the tilemap? That is, have sprites react to a directional light or point light and also receive shadows by using the correct shader (I think sprites/diffuse works)?
     
  50. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Thanks for taking your time to consider this tool.
    About your question, you can use the unity lighting system changing the Tilemap material for a material with a Sprite/Diffuse shader.