Search Unity

[RELEASED] Super Tilemap Editor

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

  1. ChunkyCurd

    ChunkyCurd

    Joined:
    Mar 27, 2016
    Posts:
    2
    HI CreativeSpore,

    Just purchased Super Tilemap Editor and I'm really enjoying it so far. It does save me quite a bit of headache and the features are well thought out and user friendly.

    Although, here has been one problem that I've been experiencing. The tile colliders only extend to the borders of the chunk (being 60x60 right?). This is frustrating because how I have it setup is that when the player is in the water, the player speed is reduced and a sprite mask enables that causes his lower body to disappear to make it look like he is partially submerged. Had the collider not stopped at the border of the chunk then this would have worked seamlessly. I get that there are problems with setting the tileset to use PolygonCollider2D's and IsTrigger enabled. However, for the water to work in my case, this is the only reasonable method (at least from what my brain can comprehend).

    Below is a visual of what I'm experiencing:



    As from the GIF (which I'm sorry is poor quality), we can see that the player can detect going in and out of the water no problem. It's when the player crosses over the chunks is when he starts glitching out (or rather, detecting an exit of the collider, due to the chunks splitting the water collider in half, kinda). I've also attached an image to show exactly where the chunk borders are:

    pic.png

    It would be greatly appreciated if you could give some insight as to ways around the chunk borders or some feature in the super tilemap editor that is designed to do stuff like detecting the player in water or another area. Thank you!
     
  2. CreativeSpore

    CreativeSpore

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

    Good to know you are enjoying the tool ;)

    About your question, for performance reasons, the tilemap chunks are like individual small tilemaps, so the colliders are separated between chunks. But fixing you issue is easy. You only need to use a counter of how many colliders you have entered and exited.
    Something like this:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using CreativeSpore.SuperTilemapEditor;
    5.  
    6. [RequireComponent(typeof(SpriteRenderer))]
    7. public class TestInsideTilemapCollider : MonoBehaviour {
    8.  
    9.  
    10.     public bool IsCollidingTilemap()
    11.     {
    12.         return m_colliderCount > 0;
    13.     }
    14.  
    15.     private SpriteRenderer m_spriteRenderer;
    16.     private void Start()
    17.     {
    18.         m_spriteRenderer = GetComponent<SpriteRenderer>();
    19.     }
    20.  
    21.     private void Update()
    22.     {
    23.         m_spriteRenderer.color = IsCollidingTilemap() ? Color.red : Color.white;
    24.     }
    25.  
    26.     private int m_colliderCount = 0;
    27.     private void OnTriggerEnter2D(Collider2D collision)
    28.     {
    29.         bool isTilemapChunk = collision.gameObject.GetComponent<TilemapChunk>();
    30.         if(isTilemapChunk)
    31.             ++m_colliderCount;
    32.         Debug.Log("OnTriggerEnter2D " + collision.name + " isTilemapChunk = " + isTilemapChunk + " colliderCount " + m_colliderCount);
    33.     }
    34.  
    35.     private void OnTriggerExit2D(Collider2D collision)
    36.     {
    37.         bool isTilemapChunk = collision.gameObject.GetComponent<TilemapChunk>();
    38.         if (isTilemapChunk)
    39.             --m_colliderCount;
    40.         Debug.Log("OnTriggerExit2D " + collision.name + " isTilemapChunk = " + isTilemapChunk + " colliderCount " + m_colliderCount);
    41.     }
    42. }
    43.  
    This is just an example, but you can optimize if by having a reference to your tilemapgroup gameobject and just checking if the collider.transform.root is equal to the tilemapGroup transform. It would be faster that calling the GetComponent each time you enter or exit a collider.

    I hope this helps.
     

    Attached Files:

  3. ChunkyCurd

    ChunkyCurd

    Joined:
    Mar 27, 2016
    Posts:
    2
    Thanks for the quick response! Method you posted with some slight modifications works perfectly. Thanks again!
     
    CreativeSpore likes this.
  4. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    I'm using the Playmaker actions here.

    The "key" graphic here represents the player. I was just too lazy to draw a player graphic.

    Here's the basics:

    A Tilemap Grid Iterator feeds a Linecast 2d and on a hit event "set tile color's" a tile to the grid position. In revisions after this screen shot was made I exempted walls from being covered.

    Two issues:

    1) Clearing the color channel creates a flicker on every player turn. I also tried painting tiles and a bunch of other methods to get rid of darkness but was always left with a flicker between turns. I think I'm probably doing this in the slowest possible manner.

    2) The tilemap grid iterator goes through the entire map. It's a very handy function, but if your map is 255x255 that's probably a lot. I need it to only go through the map that is within view of the camera.

    2a) I couldn't get bools or parameters to read while iterating. The variable I was monitoring never changed. I probably did it wrong.

    It took me a while to realize that the Grid Iterator could spit out vector 2 or a grid position.

    *Post edited for better clarity and updates.
     

    Attached Files:

    • los.jpg
      los.jpg
      File size:
      109.3 KB
      Views:
      756
    Last edited: Mar 25, 2018
  5. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Really like Super Tilemap Editor - bought it specifically for the Playmaker support.

    1) Would you possibly be able to write a tutorial on how RogueLikeMapGenerator is done so we can edit it to our needs?

    2) Does STE include saving/loading maps yet? If not, can you provide steps on how to?

    3) Using the built-in pathfinding in the asset, how would we determine distance from the gameobject to the destination? For example, I have multiple units in my game. What I need to do is to check all of them and ask "Who is closest to this target tile?" and then send only that unit. I don't suppose there is a Playmaker action?

    4) What would be the best way to handle colliders if you want pathfinding agents to stay on a road? Since it would need to use auto-tiling to connect paths, it seems tricky. Always place 3 tiles and set the middle tile to no collider and the left/right tiles to have colliders?

    5) I noticed on your RPG Map Maker asset you offer a minimap. Are there plans to include that in Super Tilemap Editor?

    Would be great if your response could be geared towards the Playmaker user or someone new to scripting.

    Thanks!
     
    Last edited: Mar 28, 2018
  6. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there,
    For the color painting, did you tried the "[PM4STE] Fog Of War using Vertex Paint" demo? It is doing something similar.
    The flickering could be fixed calling UpdateMeshImmediate instead of UpdateMesh.
    I have added a boolean property called onlyVisibleTiles to the tilemap iterator action in the attached package. I didn't test it. Could you test it and let me know if it is working fine?
    Thanks!
     

    Attached Files:

    SiliconAvatar likes this.
  7. CreativeSpore

    CreativeSpore

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

    I answer you below:

    1) Would you possibly be able to write a tutorial on how RogueLikeMapGenerator is done so we can edit it to our needs?
    Yes, I will try to write a tutorial during this week.

    2) Does STE include saving/loading maps yet? If not, can you provide steps on how to?
    I guess you mean loading the state of the tilemap during the game. There is no specific way to save a tilemap because there is a lot of data you may want to save.
    For example, the position, transform and scale, the data form gameObjects inside the tilemap generated by prefabs attached to tiles, etc
    The easiest way to save a tilemap would be to iterate through all the tiles and saving the unsigned int for each tileData contained in each cell in a list or array. And also save the MinGridX, MinGridY, MaxGridX and MaxGridY values to regenerate the tilemap in the same order it was saved.
    You can use the utils methods TilemapUtils.IterateTilemapWithAction or just use a for loop.
    I didn't try the JsonUtility class, but maybe it could be useful as well.

    3) Using the built-in pathfinding in the asset, how would we determine distance from the gameobject to the destination? For example, I have multiple units in my game. What I need to do is to check all of them and ask "Who is closest to this target tile?" and then send only that unit. I don't suppose there is a Playmaker action?
    There is no playmaker action for this. But you can access the variable m_pathNodes in PathfindingBehaviour to check the number of nodes (m_pathNodes.Count). In your case, you could use a separate script calculate a path from each unit position to the target position and assign the path to that unit (setting the varilable m_pathNodes). The PathfindingBehaviour is though to start moving the gameObject once the m_pathNodes is set.

    4) What would be the best way to handle colliders if you want pathfinding agents to stay on a road? Since it would need to use auto-tiling to connect paths, it seems tricky. Always place 3 tiles and set the middle tile to no collider and the left/right tiles to have colliders?
    The pathfinding is generic and uses an interface for the nodes IPathNode. It is implemented by MapTileNode to work with the STE tilemaps. There is a method called GetNeigborMovingCost that will return the cost to move from a node to another. You can see here, the cost is infinite for blocking tiles, 1 for vertical and horizontal tiles and 1.41 for diagonal tiles. You can change the 1 and 1.41 value multiplying it by a tile factor. You can use tile parameters for this.
    You can check how IsPassable method works. It iterates through all the tilemaps in a tilemapGroup and returns false if at least a tile has colliders on it.
    You can get a factor doing the same and return the first value found for a tile factor different than 1f:
    Tile tile; tile.paramContainer.GetFloatParam("movingFactor", 1f);

    5) I noticed on your RPG Map Maker asset you offer a minimap. Are there plans to include that in Super Tilemap Editor?
    You can use the method TilemapUtils.CreateTilemapGroupPreviewTexture to generate a preview texture for a tilemap or tilemapGroup.
     
  8. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Thanks!

    For #4, would it be easier (for me to understand) to make all tiles have colliders except for the ones I place for roads, to keep them on the road? Or is having that many colliders really performance intensive?

    For #5, it stores into a Texture2d, but it seems like there's no way to convert Texture2D to Texture for use with any of the Playmaker actions. Any advice?

    Do you offer (paid) contract work? If so, can you send me an email?
     
    Last edited: Mar 28, 2018
  9. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    Oh cool - thanks. I will test that out this weekend.

    I will look for the demo too. I thought I'd looked at all of them but I might have missed one.
     
  10. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    Hi - the Playmaker script you created with the boolean addon that makes it only iterate through visible tiles appears to work properly for top, left, and right, but it still seems to iterate through everything in the scene below the camera.

    It could also be the demo scene I set up to test though. I will try it more tomorrow.
     
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    For the roads, if you only want the units to walk over the reads, yes, it would be easier in that way. For the performance it should be a problem, the colliders are optimized creating only the needed lines. But you can avoid the colliders to be regenerated if you set the tilemap colliders to none and modify the code a little removing this line:
    upload_2018-3-30_12-40-51.png

    About the Texture2D and playmaker, I didn't try myself, but Texture2D inherits from Texture so you should be able to use it as a Texture. What in Playmaker is preventing you to use a texture2D?
     
  12. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I'm getting an error with 1.4.8 in Unity 2017.1.0p4

    MissingReferenceException: The object of type 'STETilemap' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.

    CreativeSpore.SuperTilemapEditor.STETilemap._OnPreCull (UnityEngine.Camera cam) (at Assets/Plugins/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/STETilemap.cs:457)
    UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/CameraBindings.gen.cs:731)


    I'm not sure what the cause is, it seems to just appear randomly and then only an Editor restart will stop it, until it reappears again.

    It seems to happen when I open the Editor, press Play then Stop, change scene then press Play again.
     
    Last edited: Apr 1, 2018
  13. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    It looks like a Unity bug in this case. _OnPreCull is added to the Camera.onPrecull event in the OnEnable event and removed in the OnDisable event. So it looks like the STETilemap component was destroyed without calling OnDisable event.
    Could you tell me what version of Unity are you using?
    If you want to temporary fix it, add these lines to the _OnPreCull event:
    upload_2018-4-1_14-54-19.png
     
  14. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I've added the lines but the error still appears, i'm using Unity 2017.1.0p4
     
  15. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    So the issue comes from one of my editor scripts when RemoveNameModification() is called if the gameobject with the script was selected before pressing play, i'm not sure i understand why, by using EditorApplication.isPlaying to prevent it from running during play the error doesn't appear.



    Code (CSharp):
    1.  
    2.     void OnEnable()
    3.     {
    4.         folder = (Folder)target;
    5.         RevertPrefabNames();
    6.     }
    7.  
    8.     public void RevertPrefabNames()
    9.     {
    10.         Transform[] allChildren = folder.GetComponentsInChildren<Transform>();
    11.  
    12.         foreach (Transform child in allChildren)
    13.         {
    14.             if (PrefabUtility.GetPrefabType(child) == PrefabType.PrefabInstance)
    15.             {
    16.                 var prefab = PrefabUtility.GetPrefabParent(child);
    17.  
    18.                 Undo.RecordObject(child, "Revert perfab name");
    19.                 child.name = prefab.name;
    20.                 Undo.FlushUndoRecordObjects();
    21.                 RemoveNameModification(child);
    22.             }
    23.         }
    24.     }
    25.  
    26.     public void RemoveNameModification(UnityEngine.Object obj)
    27.     {
    28.         var mods = new List<PropertyModification>(PrefabUtility.GetPropertyModifications(obj));
    29.         for (int i = 0; i < mods.Count; i++)
    30.         {
    31.             if (mods[i].propertyPath == "m_Name")
    32.                 mods.RemoveAt(i);
    33.         }
    34.         PrefabUtility.SetPropertyModifications(obj, mods.ToArray());
    35.     }
     
    Last edited: Apr 2, 2018
    CreativeSpore likes this.
  16. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    @CreativeSpore So I see numerous examples using `Tileset.GetTileIdFromTileData(uint tileData)` however that does not seem to be in the latest (1.4.8) version. How can I go about getting the tileId from tileData?
     
  17. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    Nevermind, I found it, I was confusing it with an instance method instead of a static method.
     
    CreativeSpore likes this.
  18. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    Hey!

    So the new Super Tilemap Editor 1.4.8 update got pretty upset when I imported an update to my tileset:

    Nothing changed except a minor update to a single tile, The sprites on the sheet have NO padding and this happens as soon as the new file is copied. Extruding does not fix the problem.

    This error didn't happen on 1.4.7, not sure what changed.
     
    Last edited: Apr 4, 2018
  19. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Sorry for that. I checked the log and I didn't see anything that could cause the issue from 1.4.7 to 1.4.8.
    If you don't mind to send me a test project, I will check it myself. You can blur the tiles or modify anyway so I just see the gaps between the tiles.
    How are you slicing the tiles by the way? Are you using a texture or the Atlas Creator Window?
     
  20. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    I figured it out.

    It looks like Super TileMap Editor was holding old padding/offset information between tileset changes even when I redid the extrusion (which hadn't happened until this last time). I resliced the old image with 0 padding and 0 offset (to "reset" the internal settings) and then redid the extrusion and now things are working fine.

    Basically it required an extra step over the normal "update the file, redo the extrusion".

    Also, I didn't dig into any data files, so the old padding caching thing is just a best guess.
     
  21. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    It's weird. It seems that a use case is not taken into account. The tilemap keeps the padding and offset only in case you want to slice the atlas texture again with those values, but once the tiles are sliced that value is not applied. For example if you use the Atlas Editor Window it will recreate the tiles but the tileset padding and offset values will remain like before.
    Anyway, good to know it was fixed ;)
     
  22. andytlin74

    andytlin74

    Joined:
    Jan 26, 2018
    Posts:
    2
    Hi! Really loving this editor, thank you for the awesome work!

    I was hoping I could ask you a quick question.

    I am currently making a top down RPG game, and I am having a bit of issue with the collision, namely, collision regarding stairs.

    Screenshot_693.png
    For example, my character here is on the hill, and the collision is set up properly so she can only move in these three spaces. No problem here.

    Screenshot_694.png
    Here, I've placed two stair tiles on another layer that is above the hill. The stairs themselves don't have collision, but it also will not override the collision of the hills below, so the character will not be able to travel down. I am looking a way to perhaps specify some tiles so that any tilemap that has this tile on any layer will always be forced to have no collision, no matter what the other tiles there are on this grid position.

    Screenshot_695.png
    I have also tried removing the hill tiles for below the stair tiles, but that will destroy the hill's integrity due to it being drawn with a brush.

    Thank you so much for your help!
     
  23. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    What is the easiest way to show a placement cursor (at mouse cursor) that snaps to the grid as you move your mouse so you know where you will be placing a tile at runtime?

    Right now I just set the Placement Cursor at my mouse X/Y, but it does not snap to the grid, so its confusing for the player.

    I've tried playing with GetMouseGridX/Y but it was extremely slow updating it constantly as the cursor moved.

    Is there a way to convert GridX/Y into world space? Because I can do GetMouseGridX and GetMouseGridY, then Set the Position of the placement cursor object to those values - but I can only set it based on World/Self. How do I set a regular gameobject based on the Grid?

    *To clarify by Placement Cursor, I mean something like this: https://gyazo.com/1ddd7ef0c3b88a37330dd07efae318fa
     
    Last edited: Apr 5, 2018
  24. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there,
    Thanks for your kind words about the editor ;)

    About your question. The tilemaps works as a separate element right now so there is no easy way to avoid a tile in a tilemap to avoid generating a collider, but there is a way you can achieve this:

    You can use a single tilemap just for colliders. It can be not visible or just use an empty tile for this.
    You still will add the colliders to the tiles that are supposed to be non passable, like your clift tiles, but the tilemap you use to paint them will have the Collider settings set to None. Only a tilemap will be used to place colliders using a script.
    This script will iterate one of the tilemaps, the one you know has the bigger bounds (ex: Ground Tilemap) and then, for each grid position, check if there is a tile with colliders or not using your own rule.
    For example, you can decide a grid position should have colliders based on the last non empty tile found. If you sort the tilemaps by sorting order, you can go from top to bottom and just check the first non empty tile.
    This is how it would look. I guess it should be activated when Start event is called.
    Code (CSharp):
    1. private TilemapGroup m_tilemapGroup; //the reference to the tilemapGroup
    2. void Start()
    3. {
    4.     STETilemap colliderTilemap = m_tilemapGroup.FindTilemapByName("ColliderTilemap");
    5.     STETilemap iterateTilemap = m_tilemapGroup.FindTilemapByName("Ground");
    6.     int colliderTileId = 5; // the tile used to add colliders to the collider tilemap, ex the tileId 5
    7.     colliderTilemap.ClearMap();
    8.     for (int gy = iterateTilemap.MinGridY; gy <= iterateTilemap.MaxGridY; ++gy)
    9.     {
    10.         for (int gx = iterateTilemap.MinGridX; gx <= iterateTilemap.MaxGridX; ++gx)
    11.         {
    12.             //iterate now through all the m_tilemapGroup
    13.             for(int i = m_tilemapGroup.Tilemaps.Count - 1; i >= 0; --i)
    14.             {
    15.                 //skip the collider tilemap
    16.                 if (m_tilemapGroup[i] == colliderTilemap) continue;
    17.                 Tile tile = m_tilemapGroup[i].GetTile(gx, gy);
    18.                 if(tile != null)
    19.                 {
    20.                     if (tile.collData.type != eTileCollider.None)
    21.                         colliderTilemap.SetTile(gx, gy, colliderTileId);
    22.                     return; // continue to next grid position
    23.                 }
    24.             }
    25.         }
    26.     }
    27.     colliderTilemap.UpdateMesh();
    28. }
    29.  
    I didn't tried it but let me know if you need any more help or explanation.
     
    andytlin74 likes this.
  25. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    It's weird that GetMouseGridX/Y is being so slow. It should be really fast, like less than a ms. How are you calling it?
    I made a test with a simple script that you can use to snap an object position to a tilemap grid:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace CreativeSpore.SuperTilemapEditor
    5. {
    6.     public class TestCursor : MonoBehaviour
    7.     {
    8.         [SerializeField]
    9.         STETilemap m_tilemap;
    10.        
    11.         void Update ()
    12.         {
    13.             int gx = TilemapUtils.GetMouseGridX(m_tilemap, Camera.main);
    14.             int gy = TilemapUtils.GetMouseGridY(m_tilemap, Camera.main);
    15.             transform.position = new Vector2(gx * m_tilemap.CellSize.x, gy* m_tilemap.CellSize.y);
    16.         }
    17.     }
    18. }
    19.  
    This should work as you want. You need to drag a tilemap to the m_tilemap property first.
     
  26. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Thanks!
    So what would be the code if I wanted to know the tilemap Grid position of a GameObject? Basically, how to convert a real world gameobject position into tilemap grid position.
     
    Last edited: Apr 5, 2018
  27. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    You can use TilemapUtils.GetGridPosition method for that.
    ex: Vector2 gridPos = TilemapUtils.GetGridPosition(tilemap, player.transform.position); //in case tilemap position is (0, 0)
     
  28. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146

    Attached Files:

  29. RadioactiveBullfrog

    RadioactiveBullfrog

    Joined:
    Jul 8, 2017
    Posts:
    55
    I am interested in purchasing this asset, but I am wondering what advantages it offers over a program called Tiled?
     
  30. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    It looks fine in the screenshot. Do you have more information about what is failing exactly? For example the error callstack to check the failing method?
     
  31. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there,
    Thanks for having your time to consider this tool.
    About your question:
    The main advantage would be that Super Tilemap Editor (STME) is integrated with the Unity editor, so you can modify the tilemap in the editor (also while playing) and during the game. It can be used also to place prefabs in the scene, attaching prefabs to the tiles.
    You can create custom brushes using the IBrush interface (not sure if Tiled has the same feature)
    I think the performance is better when drawing big maps in real time, like procedural maps.

    Here you can also see a comparison between STME and the Unity Tilemap with a list of features as well that you could check:
    https://forum.unity.com/threads/released-super-tilemap-editor.387330/page-18#post-3287124

    As both tools are good tools in their way and there would be a lot of features to enumerate all of them, if you have a question about something specific let me know and I'll be glad to answer.
     
    RadioactiveBullfrog likes this.
  32. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Here is the error (and it stops at the Call Static Method event for STE in my FSM):

    ArgumentException: failed to convert parameters
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:192)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    HutongGames.PlayMaker.Actions.CallStaticMethod.DoMethodCall () (at Assets/PlayMaker/Actions/ScriptControl/CallStaticMethod.cs:90)
    HutongGames.PlayMaker.Actions.CallStaticMethod.OnEnter () (at Assets/PlayMaker/Actions/ScriptControl/CallStaticMethod.cs:44)
    HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex) (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
    HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
    HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2695)
    HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
    HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2570)
    HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2711)
    HutongGames.PlayMaker.Fsm.Update () (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1934)
    PlayMakerFSM.Update () (at C:/Users/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:539)


    Any ideas? Thanks again!
     
  33. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    I think I see now the issue. You are assigning a Tileset, not a STETilemap, to the STETilemap variable:
    upload_2018-4-9_18-38-43.png
    You should drag here a STETilemap component from a tilemap in the scene.
     
  34. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    That worked, thanks!
     
  35. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    You are welcome ;)
     
  36. DanielThomas

    DanielThomas

    Joined:
    Mar 30, 2013
    Posts:
    111
    Might be an obvious answer, but just to make sure.
    In Unity 2017 tilemap system the tiles don't sort individually if you use a sorting group (since it combines the whole layer into one object). I would need this for top-down perspective like old JRPG's and when character need to sort when behind or in front of a fence (made with autotiling).
    Would STE work with sorting-groups and have tile sort individually with everything in the sorting group?
    Thanks!
     
  37. Lightrail

    Lightrail

    Joined:
    Apr 12, 2013
    Posts:
    37
    So I'm unsure if this is Super Tilemap Editor giving me this issue, but I'm getting this error and it only appears after editing a tile map in a scene, saving, and opening it again later. It's kind of random too as it doesn't happen all the time, but definitely only in scenes with Super Tilemap Editor components. Maybe someone else has ran into the issue as well.

    I'll get a bunch of errors, usually 5-10 of them that all look like:
    Code (CSharp):
    1. Could not extract GUID in text file Assets/Scenes/TestRoom.unity at line 7673.
    I'll open the scene with Notepad++ and the lines in question look like:
    Code (CSharp):
    1.     - {fileID: 2, guid: 00000000000000000000000000000000, type: 0}
    I can delete them no problem, they just prevent me from creating a build. Problem is they continue to make an appearance after messing with my tilemaps and maybe it's a known issue or someone else is running across it?
     
  38. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    You can change the sort order to Top Right. Even if all the tiles are rendered using the same sorting layer and order, changing the order of the tiles in the combined mesh will make top tiles being painted before bottom ones and be behind:
    upload_2018-4-16_9-12-58.png

    Also, you can paint tiles individually as well attaching a prefab to a tile and attaching to the prefab the component TileObjectBehaviour to replicate the tile where it is attached to, and any other component like a sorting component that changes the sorting order according to the Y position to make what you need.
     
  39. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    This is the first time I hear about this bug. Maybe it's related with your Unity version.
    Usually in these kind of lines you see a member name to the left, like:
    m_SplashScreenBackgroundLandscape: {fileID: 1, guid: 00000000000000000000000000000000,
    type: 0}
    Don't you see anything like a name? It could give me a clue.
     
  40. SamFZGames

    SamFZGames

    Joined:
    Mar 2, 2014
    Posts:
    52
    Hi there, I have a problem.

    On my tile map, I am using edge colliders, and I need some of my platforms to have just a collider along the top edge, just one flat edge collider, no sides or bottom colliders. The tile map properties window only gives me the option to have 3 or less vertices and if I make the 3rd vertex overlap the line to create a flat collider, it throws an error trying to build the colliders. How can I create a flat edge collider with only 2 points?
     
  41. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    40
    When trying to use your IterateTilemapWithAction for saving, how would I interface Playmaker with the second param, the action portion which is of type System.Action<STETilemap, int, int>

    From what I understand from the code, i'm basically calling a method here that acts on the tiles. Like erase, or potentially save? But playmaker needs an object, and under the STE folder this is all I get:

    https://i.imgur.com/eADUTxk.png

    https://i.imgur.com/xlQZYt1.png
     
    Last edited: Apr 16, 2018
  42. Lightrail

    Lightrail

    Joined:
    Apr 12, 2013
    Posts:
    37
    There's no name next to it which, as you said, would actually help me track down the issue. I'll have to wait for the error to rear its ugly head again to get back to you on anything new.

    I'm not even sure it's STE but was wondering if anyone else might have had this issue as well since it only happens in scenes with STE (it could very well be something else though).
     
  43. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    For design, the tile collider shape needs to have at least 3 vertices. If you want to use only a flat edge, you would need to attach a prefab to the tiles with an edge collider on top and check the option "Show Tile with prefab". This will instantiate the prefab with the edge collider on top.
    Depending on your platform implementation you could also use a thin rect on top of the tile collider with height of 1 and full width.
     
  44. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Use the TilemapGridIterator instead of callind the static method. You can see an example in the Demo "Procedural Tilemap Demo".
    upload_2018-4-17_10-18-43.png
     
  45. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Hello again!

    A few more questions if you have the time...

    1) Is it possible to overlay 2 tiles in the same grid space?
    So say it is 16x16 - one tile covers the upper half of the square, the other tile covers the bottom half when placed in the same grid space.

    Right now, even with a ground overlay transparency, a grid space gets replaced completely when it is painted on - even if the tile used to paint does not take up the full grid space.

    2) Any reason why the Ground layer won't give transparency? (https://gyazo.com/9f2eee4ca4338397bdef430adfbdf32f)

    3) Is it possible for the RoadBrush to be composed of more than 1 tile per space? Say when placing, I want it to put down a 9x9 chunk instead of a single tile. I can do that right now with Draw Tile Chunk, but it can't be auto-tiled to connect like the RoadBrush. I want to place a Chunk and have it auto-connect when placing chunks around it, just like the RoadBrush. Basically my roads need to be much larger than 1 grid tile so I need to spread it over multiple tiles.

    Thanks!
     
    Last edited: Apr 22, 2018
  46. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,192
    Hi there!
    I will answer you below:

    1) Is it possible to overlay 2 tiles in the same grid space?
    Yes, but you need two tilemaps for that. You cannot overlay 2 tiles in the same tilemap.
    To sort the tilemaps (so one in above the other one) you can change the sorting order.
    The only way you can overlay 2 tiles in the same tilemap is by attaching a prefab to the tile with an SpriteRenderer using a tile as sprite. And then, checking the option to display the tile together with the prefab.

    2) Any reason why the Ground layer won't give transparency?
    This is for the same commented above. The ground layer is behind the ground Overlay layer, so you are overwriting the ground tiles when drawing the tiles with alpha. You would need to use the Ground Overlay to place those tiles.

    3) Is it possible for the RoadBrush to be composed of more than 1 tile per space?
    Instead of a road brush, you can use a Carpet Brush. You can see the difference in the Roguelike tileset demo:
    upload_2018-4-23_10-39-27.png
     
  47. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Perfect, thanks!
     
    CreativeSpore likes this.
  48. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    40
    Few questions for you.

    Earlier you suggested using the playmaker Tilemap Iterate action, but earlier in the thread you suggested using the utils method IterateWithAction. What is the real difference between these two approaches?

    Lastly, when I watched your successful implementation of iteration in the procedural tilemap demo scene, I noticed the 'output' fields of the iterator aren't actually outputs, they're just tracking what tile is currently in view. Is it intended to add more actions on to this to save these values, etc? What would your ideal situation be?
     
    Last edited: Apr 24, 2018
  49. CreativeSpore

    CreativeSpore

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

    They both iterate a tilemap going for all grid positions. In case of IterateTilemapWithAction you can also receive the tileData for each position.
    In the playmaker action TilemapGridIterator you receive as an output the grid coordinates and the world position of the cell as an output, so you can later do something with that position like read the tileData or set a new tileData.
    For example in the procedural map example using Playmaker, this output is saved in a parameter called gridPos and used later to Draw a tile at that position in the tilemap:
    upload_2018-4-25_10-35-3.png
     
  50. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    40
    Why, in your procedural example, does your X start at -1?