Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[RELEASED] Super Tilemap Editor

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

  1. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Thanks for responding to my last question so quickly - I appreciate that. Another thing I'm wondering about: Does your asset use some kind of pooling system? Specifically, I'm wondering if all the tiles are instantiated at run time at startup, or does it only instantiate objects close enough to the camera. I'd like to be able to make a huge map without impacting performance.
     
  2. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    There is no pool system in STE. The tiles are created using a Mesh in chunks of 60x60 tiles by default and if you attach a prefab to a tile, it will be instantiated as soon as you paint the tile.
    About performance, the chunks are rendered only when they are visible by the camera, and some other processes like updating animated tiles, is performed also when the chunk is rendered and visible. So it should be fine to have a big map in the scene.
    If you also want to reduce the number of drawcalls (useful in mobiles) you can also change the size of the chunk to 8, to enable dynamic batching, but in most cases, this is not even needed for a good performance.
    upload_2018-6-4_13-2-28.png
     
  3. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    @CreativeSpore
    hi sir, I have a sprite that needed to be sliced manually using unity, when i add this sprite to a tileset, on the tile set AND the tile map, i see this :

    the problems :
    1- using any other number for tileRowLength than 1 won't work
    2- it's really hard to see the tiles this way for choosing and painting, what do i need to do?
     

    Attached Files:

  4. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Hi - My project is set to 2D mode and I'm trying to get 3d gameobjects (a cube in this case) to cast shadows on the tiles. I've created a simple scene with a tilemap rendering some ground tiles. In the renderer tab of the tilemap, I set the material to use the Sprites/diffuse shader and I've made sure the 'receive shadows' checkbox is checked.. I have a directional light above the tilemap (-15 z axis) and I've placed a cube 5x5 cube at -3 on the z axis. I am not seeing the tiles receiving shadows from the cube - I made sure that shadows are being cast correctly by placing a quad there and it is receiving shadows from the cube... it's just that the sprites on the tile map are not receiving the shadows. Am I going about this the wrong way? Is there a different method I should be using to get shadows to cast on the tile sprites? The sprites ARE reacting to the directional light when I change the angle (getting darker and brighter), it's just that they are not receiving shadows. Any help you can offer would be greatly appreciated.
     
  5. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Hey - nevermind on this one - I figured it out - I just needed to go find the right shader... sprites/diffuse wasn't cutting it.
     
    CreativeSpore likes this.
  6. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    Why can't you change the tileRowLength to any other number?
    How are you creating the tileset? The sliced sprites from a texture set to Sprite/Multiple or using the tileset slice button?
    Could you provide the slice settings and texture size?
    Also check if the texture Max Size is greater than the size of the texture.
     
  7. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    1- I used unity's built in slice tool on Multiple Sprite setting
    2- typing any number for the row count hitting enter will reset it to 1
    3- what do you mean the slice setting? i used the auto slice function on the unity editor, the texture size is 2k texture, nothing special.
    4- did you try your asset in unity 2018.1.0f2? can it be the problem? although there was 0 warnings or errors importing your asset.
    These are the images from the editor :
    The texture :
    upload_2018-6-13_2-43-27.png
    The Sprite Editor :
    upload_2018-6-13_2-44-27.png
    Dragging the texture to the tile set's slot :
    upload_2018-6-13_2-45-19.png
    now type any number in the box and hit enter, it jumps back to 1 !!!! upload_2018-6-13_2-46-1.png
    same problem with the tile pallet rowLendth, it will go back to 1
    Using the slice atlas button :
    upload_2018-6-13_2-48-56.png
    now it's behaving but these are not the slicing i need to work with, i need to work with the slicing i have from the unity's build it slicer so that i place blocks because.....the blocks are screwed now, forums don't let me post another picture, will post the picture in next post
     
    Last edited: Jun 13, 2018
  8. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    upload_2018-6-13_2-51-29.png
    compare these with the picture i sent you from the built in unity's when i manually sliced the sprite sheet, and now, i can't change that 13 number to go higher than 13 !!!!
    upload_2018-6-13_2-55-51.png
    this is the best i could get but this, in my opinion, shouldn't be the way to go, because now, how would i assign a prefab made for a whole block when that block in now sliced into multiple smaller ones? also, each time now i need to select multiple blocks, not to mention....
    Now this happens and that is naturall, when i have to choose empty space around a block, those blocks wouldn't sit nice and tight,
    upload_2018-6-13_2-58-44.png
    this means that now either i have to through away using the asset, or, go through all the assets i got and tweak the images in a program like photo shop and see if i can make them work properly or not !
     
  9. Maldruzard

    Maldruzard

    Joined:
    Oct 26, 2014
    Posts:
    15
    Hi there! Just bought your asset a few days ago and I absolutely love it so far.

    One issue I've just come across is that your method for getting a tile that has been collided with doesn't seem to work using 2D colliders, as there is no such thing as other.impulse in Unity's 2d physics/colliders. I tried using relative velocity normalized instead but obviously that has quite a bit of inaccuracy if the collision is at an angle, and quite often gets the adjacent tile instead.

    Is there any solution for consistently getting the correct tile with 2D collisions, as other.impulse cannot be used?

    Big fan, cheers.
     
    Last edited: Jun 20, 2018
  10. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    Hi there,
    First of all, sorry for my late answer. I couldn't answer until now.
    I found the issue. There was a bug changing the TileRowLength. I have fixed it and attached a path to this post.
    Let me know if you find any issue now changing the TileRowLength.
     

    Attached Files:

  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    Hi there,
    Good to know you like this asset ;)
    About your question, could you post the method you are using? Is it in the forum or in the asset code?
     
  12. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilesetEditor.cs(121,46): error CS0029: Cannot implicitly convert type `void' to `bool'

    Code (CSharp):
    1. if(m_tilesetCtrl.Display())
    2.      Repaint();
    The tileSet.Display() is returning void not bool

    Edit : By the way can i ask for a little feature? When we are defining brushes like brush 47, the brush preview in the pallet window, can you introduce a field so that we can customize that icon to show up in the pallet view per brush? you can check if it's null or not to fall back to current behavior?
     
    Last edited: Jun 21, 2018
  13. Maldruzard

    Maldruzard

    Joined:
    Oct 26, 2014
    Posts:
    15
    Yo!

    So the method I tried to use was one you posted way back in this thread:

    Code (CSharp):
    1. void OnCollisionEnter(Collision other)
    2. {
    3.   Vector3 tilePosition =  transform.position - other.impulse; // subtracting the impulse applied to resolve the collision, tilePosition should be the position inside the tile.
    4.   Tilemap tilemap = other.gameObject.GetComponentInParent<Tilemap>(); // this will take the tilemap involved in the collision
    5.   if(tilemap)
    6.   {
    7.     uint tileData = tilemap.GetTileData(tilePosition);
    8.     int tileId = Tileset.GetTileIdFromTileData(tileData);
    9.     int brushId = Tileset.GetBrushIdFromTileData(tileData);
    10.     Tile tile = tilemap.Tileset.GetTile(tileId);
    11.   }
    12. }
    But collision2D doesn't have .impulse functionality like 3D collisions have, or an equivalent.

    I've managed to get something quite consistent to work, that gets the tilePosition by instead getting the direction from the colliding object to the averaged contact points of the collision, added to the inverse collider normal of the collision point. This seems to work 99% of the time, but there's still some inconsistency where bullets hit at a weird angle and don't destroy tiles and register the tile location as open space next to it instead.

    Is there any 2d collider method you would recommend that would work better than this for getting the tileposition on 2D collision?

    Edit:
    As an additional quick question (sorry haha), is there any way to only update the mesh of chunks that were affected by a tile change/erase? In my current project, I destroy tiles with bullets very frequently, but the size of the tilemap (most of which has 2d colliders) is quite large, so it seems inefficient to be updating the entire map every time a bullet hits instead of just the individual chunk meshes/collider meshes. However, I completely understand if the system just isn't built that way, or if thats what its already doing, and its not a huge issue either way :)

    Thanks again for making this system, it has saved me such a huge amount of dev time :)
     
    Last edited: Jun 21, 2018
  14. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Hi!

    I'm just getting started with Super Tilemap Editor and creating a sort of "building game" with it.
    I am also using your A* path finding solution, which works great for pre built maps.

    How can I set tile instances to be blocked, if I e.g. build a house on the ground (Note that the house is a prefab and not neccessarily tile based)?

    I am able to get the tiles like so:
    Code (CSharp):
    1. Tile tile = tilemap.GetTile(GridX, GridY);  
    But if I set the blocked info:
    Code (CSharp):
    1. tile.collData.type = eTileCollider.Full;
    This sets the property for all tile instances.

    My current workaround is, to expand your MapPathFinding.cs with an array list of additional blocked grids.
    This seems to work, but it'd be interesting to know, what the official way of doing this would be.

    Hope my question is clear :)
    Thanks!
     
  15. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    I created the patch using my current version of the asset with multiples changes.
    I will release a new version soon, including this patch, but if you cannot fix the errors, send me an email and I will send you the last version.
    About the preview, I will try to get some time to add it.
     
  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    To be honest, I use 3D colliders even for 2D games until recently, that I moved to 2D. I didn't know 2D colliders doesn't have impulse. I also notice that is a good practice to change the pixels per units to be the same as the tile size, so the colliders are not so small. In 2D small colliders are an issue and there is like a small separation between colliders when the scale is too small that could lead to impressions.

    About the last question, the tilemap is optimized to update only the updated chunks. So it should already do that. You have to call UpdateMesh, not UpdateMeshImmediate, to avoid updating it with each modification and make it update once during the Update event.
     
  17. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    You could extend the MapPathFinding to check if a tile is passable by trowing a raycast from previous tile to the next one. This way it would be based on colliders instead and you could add prefabs with a collider on it.
    Also, if the instance is the size of a tile, you can add colliders to the tile where the prefab is attached to.
     
  18. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Sounds like a good idea, I'll give it a shot, thanks!
     
    CreativeSpore likes this.
  19. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Sent you an email sir
     
    CreativeSpore likes this.
  20. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    By the way, have a question i 47 brush, is there any guide anywhere on web for how should a sprite be designed for each part? i know that the guide on the brush can be good but if you look at the pictures i sent about my tiles, i was wondering, if i want to expand those tiles to fit all of those 47 slots, how should i change the graphics of each block to match the needs?

    Also another question regarding build time, what will be included in build and what will be dropped?
     
    Last edited: Jun 24, 2018
  21. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    I have attached a demo using the brush47. I hope it is more clear with an example :)
    I didn't understand the last question.
     

    Attached Files:

  22. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    The second question is about the build time on game publishing, knowing that when we paint sprites, instead we can put prefabs in game, also, the functionality of chunks, i had a question of how much overhead these things can put in build time (well, beyond what the prefab would naturally put there). i was wondering if you just hide the sprites in the hierarchy window or do you actually handle the placement and functionality by chunks themselves, if it's the second case, then the question is valid to know what kind of overhead and stuff will be included in game build.
     
  23. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    The chunks are only used to place the tilemap geometry. If you draw a tile with a prefab attached, the prefab instance is created as a children of the tilemap gameObject, not the chunk.
    upload_2018-6-27_12-11-37.png

    In a build, all elements in the scene will be included: prefab instances and all the chunks of a tilemap and the tilemap.
     
  24. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Hi - Is there a way to make the image in a tile extend out beyond the edge of the tile so that it overlaps the image in the adjacent tiles?
     
  25. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    Yes, you can use a prefab for that tile with a SpriteRenderer. If you want to replicate the tile, you can attach the component TileObjectBehaviour.
     
  26. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    New version of Super Tilemap Editor v1.4.9 available!

    Changelog v1.4.9:

    • ADDED button to generate a procedural map in the RogueLikeMapGenerator component.
    • ADDED RefreshTile to STETilemap component to reset the update flag and force a tile brush refresh after calling STETilemap.UpdateMesh
    • IMPROVED Tileset Inspector drawing performance
    • IMPROVED Tileset Inspector Performance
    • IMPROVED: cached all properties in TilemapEditor
    • FIXED AtlasCreatorWindow null exception when saving an atlas texture if any of the tile textures was compressed
    • FIXED exception error using AtlasCreatorEditor with no Tileset set
    • FIXED removed redundant last vertex in polygon colliders. This also fix some issues with navmesh.
    • FIXED: not overwriting tilemap orderInLayer when editing multiple tilemaps
    • FIXED allow changing the tileset parameter TileRowLength
    • FIXED removing wrong references of tiles when tiles are removed from a tileset
    • FIXED class conflicts in PixelEdit
     
  27. Kaven-Co-Games

    Kaven-Co-Games

    Joined:
    Jun 3, 2014
    Posts:
    19
    So I recently bought the plugin, wondering how I can change the pixel size of the tiles. It feels like the tileset "Pixel per Unit" is not reflective of what I'm looking to change. Likewise, I have a tilemap in my own data structure and when I attempt to hover over tiles to find their ID I realize that the actual tiles being visualized are not 32x32 but a much smaller number. I need all units of measure in this game to be 32x32 pixels. Am I doing something wrong?
     
    Last edited: Jun 29, 2018
  28. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    If you want a pixel to be the size of a unit in space, you need to set the pixels per units value to 32.
    Once the pixels per units is set to 32, any tilemap you create and assign this tileset will change the CellSize to (32,32).
    But, if you have some tilemaps created already, you need to change the CellSize to (32,32) manually or pressing the Reset button 'R'.
    The tilemap CellSize is the one that changes the tile size at the end.
    upload_2018-6-29_12-5-59.png
     
    Kaven-Co-Games likes this.
  29. Kaven-Co-Games

    Kaven-Co-Games

    Joined:
    Jun 3, 2014
    Posts:
    19
    As a side question, I have been working on my game using your very helpful asset, and I was wondering about some of your implementation in the 2d pathfinding. I am familiar with the subject, but find it very difficult to understand holistically. What incisions into your pathfinding would you suggest to allow for separate movecosts per-tile? I.e.: rough terrain is worse than a dirt road, etc.
     
  30. CreativeSpore

    CreativeSpore

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

    A* pathfinding usually works with node weights to check for the fastest path.
    In the current implementation, the value is the distance to the neighbor node: 1 for vertical and horizontal tiles and 1.41 for diagonal tiles. And a very high value for non passable tiles: PathFinding.k_InfiniteCostValue = float.MaxValue.

    To use a separate cost for the tiles, you can use tile parameters to multiply a float parameter like "CostFactor" to the moving cost calculated in the MapTileNode class:
    upload_2018-7-2_12-33-21.png

    Code (CSharp):
    1. // Get the cost factor from the tile parameters
    2. MapTileNode neighborTileNode = GetNeighbor(neigborIdx) as MapTileNode;
    3. STETilemap groundTilemap = m_tilemapGroup["Ground"];
    4. uint tileData = groundTilemap.GetTileData(neighborTileNode.GridX, neighborTileNode.GridY);
    5. ParameterContainer paramContainer = TilemapUtils.GetParamsFromTileData(groundTilemap, tileData);
    6. if (paramContainer != null)
    7. {
    8.     fCost *= paramContainer.GetFloatParam("CostFactor", 1f); // use value 1f if the parameter is not set
    9. }
    10.  
     
    Kaven-Co-Games likes this.
  31. Maldruzard

    Maldruzard

    Joined:
    Oct 26, 2014
    Posts:
    15
    Hi there again!

    Once again, thanks for making this awesome asset. I cannot understate how much time and effort it has already saved me :)

    I've come across a small issue with polygonal colliders also expressed by others elsewhere in this thread: when there is an enclosed room (all within chunk boundaries) created by the carpet brush with tiles set to polygonal colliders, the collider spreads inside and causes all sorts of nasty behaviour with physics/colliders within the room.

    To the others you suggested switching to edge colliders which would otherwise solve the issue, but I'm afraid I don't think that would work for me as the inner-collider collisions are quite important to a substantial amount of my gameplay functionality.

    Is there any way to solve this issue without resorting to the edge colliders?

    Cheers again <3
     
  32. Kaven-Co-Games

    Kaven-Co-Games

    Joined:
    Jun 3, 2014
    Posts:
    19
    Thanks so much for your help, if I have anything else I'll be sure to bark up your alley!
     
    CreativeSpore likes this.
  33. CreativeSpore

    CreativeSpore

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

    Thanks for you kind comments ;)

    About your question. You need to open the room at some point.
    upload_2018-7-3_9-43-26.png
    This way, a single collider is generated around the wall, instead of two colliders.

    You can also change one of the corner colliders like this to break the seamless pattern and close the shape around the walls.
    upload_2018-7-3_9-47-49.png

    Also, if your game uses only a single room per level, you can play with the tilemap chunks areas (marked by red lines) were the colliders are cut. So you can draw the tilemap around the grid position (0, 0):
    upload_2018-7-3_9-57-17.png
     

    Attached Files:

    Last edited: Jul 3, 2018
  34. Maldruzard

    Maldruzard

    Joined:
    Oct 26, 2014
    Posts:
    15

    Fantastic, thank you for your quick reply :)
     
    CreativeSpore likes this.
  35. Mike_011972

    Mike_011972

    Joined:
    Jun 8, 2009
    Posts:
    97
    Hello,
    This may be a stupid question but I can't seem to find any info on how to import a Pyxel map / tile set. Just for Tiled.
    I did a forum and document search on Pyxel, but didn't come back with any info (other than in the forum suggesting deleting the pixel editor folder when there was an issue installing on an older version).
    Can you point me in the right direction please? I tried exporting out as an XML file but it didn't seem to like that.

    Thanks,
    Mike.
     
  36. Kaven-Co-Games

    Kaven-Co-Games

    Joined:
    Jun 3, 2014
    Posts:
    19
    I know the pathfinding is beyond the scope of the purchase, but I do have another question since the reference URL you've commented in PathFinding.cs is a dead link.

    I have a certain manager that is constantly looking to pair characters with places, basically giving them where to go; but I need to find the lowest cost place for them to go and I don't quite understand how to modify your implementation to allow for this. I.E: I give it 5 places and it finds the closest possible one.

    I imagine I can give it a list of Vector2's and hold all the results in a queue before making them the the currentNode it should move to. Is this how you would do it?
     
  37. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    Hi there,
    This importer was added thanks to AndyGFX - CubesTeam and it was experimental.
    I have changed the asset description to include that it is experimental & unsupported (I should have added that before). But I don't mind to have a look and see what could be causing the issue.
    I guess you have followed the instructions in the manual found in:
    "\CreativeSpore\SuperTilemapEditor\Extra\Importers\Pyxel Edit\Documentation\PyxelEditManual.txt"
    Having a look into the demo scene it looks like you need to use a json file. Can you export it as a json file? And if you have any error in the console, could you post them?
    upload_2018-7-5_16-26-2.png
     
  38. CreativeSpore

    CreativeSpore

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

    Thanks for telling me about the broken link. I have fixed it with a new working link:
    http://homepages.abdn.ac.uk/f.guerin/pages/teaching/CS1013/practicals/aStarTutorial.htm

    About your question. The pathfinding system works with an origin and destination grid position and it returns back a list of nodes:

    You need a MapPathFinding instance first;
    MapPathFinding mapPathFinding = new MapPathFinding();
    In PathfindingBehaviour I use a public property to configure the instance in the inspector view:
    upload_2018-7-5_16-34-38.png
    Then, you can use this instance to calculate a route using world positions:
    upload_2018-7-5_16-37-16.png
    m_pathNodes will contain a list of all nodes, but using the INode interface. So, to get the node position (the center of the tile) you need to get the Position value of the node. In the PathfindingBehaviour I set the current node as the first node of the calculated path: m_curNode = m_pathNodes.First.
    upload_2018-7-5_16-40-22.png
    In the Update, I move the transform.position to the current node position m_curNode.Value.Position.
    And when the position is reached, if the distance is <= ReachNodeDistance, the node is updated with the next node, until the last node is reached and the value os m_curNode.Next is null.
    upload_2018-7-5_16-39-35.png

    So, in your case, you can use a list of vector2 destination values, compute a path for all of them, take the one with less nodes, and save that list in m_pathNodes before calling ProcessComputedPath.
     
    tuf_dev and Kaven-Co-Games like this.
  39. Mike_011972

    Mike_011972

    Joined:
    Jun 8, 2009
    Posts:
    97
    Thanks for the reply. I'll check tonight after work.
    Failing that, I'll just have to start to use Tiled instead.
     
  40. Mike_011972

    Mike_011972

    Joined:
    Jun 8, 2009
    Posts:
    97
    Thanks for your help on this, but I couldn't get a solid export to work for me (could import Json export thou with no errors). Just random blocks seem to render in the map when importing and only on a single layer (import does show 3 different layers thou). Not really worth my time to spend any real amount of time on this as I only have a couple of test levels that I can soon redo in Tiled or even actually in Super Tilemap itself if need be.
    Thanks for your help thou on this.
     
    CreativeSpore likes this.
  41. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    After using STE for a year now, I need to make changes to some of my atlas textures, is there a way to remap tiles so that i don't have to redo my entire world?

    For example, I need to redo my atlas texture but this will break everything if I just replace it with a new one, what I need is to swap the old Tile Palette ID with the new one so that it looks for the old tile in the new location, is this possible?

    If this is not possible, it would be a good idea to be able to tag each tiles, so that the tiles painted in the world are associated with these tags, this would allow to rename tile tags and have the tiles in the world update automatically.

    I hope this makes sense
     
    Last edited: Jul 6, 2018
  42. Kaven-Co-Games

    Kaven-Co-Games

    Joined:
    Jun 3, 2014
    Posts:
    19
    So, I've gone and attempted to implement what I need based on our previous discussion, and I don't quite understand as to why the character feels the need to move to 0,0. I've done nothing with with your movement, am I missing a fundamental idea behind m_pathnodes and ProcessComputedPath()?

    For simplicity, I am only doing Sync computation.

    Code (CSharp):
    1.                
    2.  // compute paths to destination
    3.             if (Input.GetKeyDown(KeyCode.KeypadEnter))
    4.             {
    5.                 posList = new List<Vector2>();
    6.                 // FOR TESTING, ADD THE OBJS TO POSITION LIST SO WE CAN SEE WHATS GOING ON
    7.                 foreach(GameObject obj in trackingObjs)
    8.                 {
    9.                     Vector2 position = obj.transform.position;
    10.                     posList.Add(position);
    11.                 }
    12.  
    13.  
    14.                 //m_targetPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    15.                 switch(ComputeMode)
    16.                 {
    17.                     case eComputeMode.Asynchronous:
    18.                         StopAllCoroutines();
    19.                         StartCoroutine(ComputeAsync(transform.position, m_targetPosition, AsyncCoroutineIterations));
    20.                         break;
    21.                     case eComputeMode.Synchronous:
    22.                         //first create a list of linkedlists that will act as the nodelists that we are creating.
    23.                         List < LinkedList < IPathNode >> nodeLists = new List<LinkedList<IPathNode>>();
    24.                         //iterate through all positions we need to and calculate the paths.
    25.                         foreach (Vector2 position in posList)
    26.                         {
    27.                             LinkedList<IPathNode> pathNodes;
    28.                             pathNodes = PathFinding.GetRouteFromTo(position, transform.position);
    29.                             nodeLists.Add(pathNodes);
    30.                         }
    31.                         //make a quick float arrary to hold the costs of each path.
    32.                         float[] nodecosts = new float[nodeLists.Count];
    33.  
    34.                         int index = 0;
    35.                         foreach(LinkedList<IPathNode> computedPathNodes in nodeLists)
    36.                         {
    37.                             nodecosts[index] = computedPathNodes.Last.Value.Score;
    38.                             index++;
    39.                             Debug.Log(index + " : " + computedPathNodes.Last.Value.Score);
    40.                         }
    41.                         int pos = FindMinArrayIndex(nodecosts); //gets the index of the lowest element of the array
    42.                         m_pathNodes = nodeLists[pos];       //sets the current pathnodes to the pathnodelist that has the lowest cost, of the ones calculated.
    43.                         //ComputeSync(transform.position, m_targetPosition);
    44.                         ProcessComputedPath();
    45.                         break;
    46.                 }
    47.             }
    48.  
    For some reason, the character is finding a position, as illustrated by the gizmos, but it is wanting to move to 0,0.
    As a side note, it doesn't seem to be giving me the "closest" one. I was under the impression that Node.Last.Value.Score is a total value of the 'cost' of the path. Am I wrong in thinking this?

    Here is what i am ultimately getting.
    Code (CSharp):
    1. https://gyazo.com/051922c9c1be527f595d186aa018171c
    (apparently we cant enter hyperlinks so bare with me)
     
  43. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    For performance reasons, the tiles are not tagged. Otherwise it would take a lot of time to find each tile data when updating a tilemap. The tile id is the position of the tile in the Tiles list inside the Tileset. But you can update a tileset atlas texture and keep the same order if you increase the texture height, but not the width.
    If you press the slice button again, you can decide to keep the previous tile data so you don't loose your changes in the previous tiles like the collider, prefabs and parameters.
     
  44. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    Hi there,
    I just found a bug that prevent the PathFinding to find more than a route in the same update. I think that could be the problem. But it's weird that it moves towards (0, 0) position.
    I have attached the last version of PathFinding with the last modifications. Try it and let me know if you find any issue.
    Note that the path finding folder has been changed. You may need to remove the previous files to fix compilation errors due to duplicated classes.
     

    Attached Files:

  45. Filipinjo

    Filipinjo

    Joined:
    Jan 7, 2014
    Posts:
    22
    I have a big texture (1024*4096) and when I want to extrude or preview it in atlas editor i get this error:

    Code (CSharp):
    1. ArgumentOutOfRangeException: Argument is out of range.
    2. Parameter name: index
    3. System.Collections.Generic.List`1[UnityEngine.Rect].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    4. CreativeSpore.SuperTilemapEditor.AtlasEditorWindow.BuildAtlas (UnityEngine.Texture2D atlasTexture, Int32 tilePadding, Int32 tileExtrude, Vector2 tileSize, Int32 widthInTiles, Int32 heightInTiles, System.Collections.Generic.List`1 rects) (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/AtlasEditorWindow.cs:190)
    5. CreativeSpore.SuperTilemapEditor.AtlasEditorWindow.BuildAtlas (UnityEngine.Texture2D atlasTexture, Int32 tilePadding, Int32 tileExtrude, CreativeSpore.SuperTilemapEditor.Tileset tileset) (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/AtlasEditorWindow.cs:171)
    6. CreativeSpore.SuperTilemapEditor.AtlasEditorWindow.BuildAtlas () (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/AtlasEditorWindow.cs:152)
    7. CreativeSpore.SuperTilemapEditor.AtlasEditorWindow.OnGUI () (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/AtlasEditorWindow.cs:90)
    8. 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:222)
    9. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    10. 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:232)
    11. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    12. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    13. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    14. UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
    Otherwise I've imported the tileset from TMX file... all seems cool but when I open the view of tileview "D" which is in the middle of other tileviews I get the error:

    Code (CSharp):
    1. GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    and

    Code (CSharp):
    1. ArgumentOutOfRangeException: Argument is out of range.
    2. Parameter name: index
    3. System.Collections.Generic.List`1[System.UInt32].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    4. CreativeSpore.SuperTilemapEditor.TilesetControl.Display () (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilesetControl.cs:265)
    5. CreativeSpore.SuperTilemapEditor.TilesetEditor.OnInspectorGUI () (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilesetEditor.cs:121)
    6. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1253)
    7. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    PS: Otherwise I love this asset :D
     
  46. CreativeSpore

    CreativeSpore

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

    The problem with the texture is probably because the Max Size is set to 4096. Try changing it to 8192.

    About the other problem. I am not sure why it is failing. It would be great if you can send me a test project so I can check it myself. You can blur or black the textures, I only need to check why the error is happening.
    But you can also fix it by adding this line of code. It should avoid the error and display something that could be a clue of what is happening when the tileview is displayed:
    && (tileId - tileIdOffset < tileView.tileSelection.selectionData.Count)
    upload_2018-7-11_12-50-25.png
     
  47. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    I found the bug! Here is the patch.
     

    Attached Files:

  48. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I think I found a bug, I have multiple scenes with a Tilemap in each scenes, I changed some of the collisions on the Tileset they all use, but for the changes to take effect I have to go in each scenes and save the scenes, or else they still use the old collision. It took me a while to understand why my character was going through the floor when changing scenes.
     
  49. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,189
    That is something made by design. The colliders are recalculated only if you refresh the tilemap so if you change the collider of a tile later, it wont change until you refresh the tilemap or made a modification like painting a tile (that will update only the chunk where you paint the tile).
    In the editor, you can refresh all the tilemaps at once if you press the refresh button in the toolbar while the tilemap group is selected.
    The tilemaps are also updated automatically in the current scene, but for every scene.

    You could also force a Refresh by code when the scene is started, but as this is less optimal than refresh it in the editor I prefer to leave it to the user when it is necessary using a custom script.
     
  50. Raseru

    Raseru

    Joined:
    Oct 4, 2013
    Posts:
    87
    For the AnimBrush, is there no way to set the FPS for the individual frames? Or perhaps setting a delay before it repeats each time?

    Also, is there a way to make a brush with a wall that is more than 1 tile tall in top-down like the walls inside a building or a cliff? For instance, see this image:


    Or would we need to separate that into multiple brushes?

    I've seen it done in Tiled before, but maybe it overcomplicates things:
     
    Last edited: Jul 20, 2018