Search Unity

SpriteTile, a fast dynamic tile system (RELEASED)

Discussion in 'Assets and Asset Store' started by Eric5h5, Dec 11, 2013.

  1. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    Well it is from Unity and it is not ordered by the position in the sprite sheet as you can see in the gif.
    Maybe I am doing something wrong? Idk...

    What do you mean by position anyway? Actual position? Or calculable from actual position? Or position in an array after removing all empty elements?

    It would allow referring to to sprite sheet tiles by x & y in the same way we refer to map tiles.

    Thanks.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'm afraid I don't know where all the different names are coming from. Here I have a sprite sheet cleverly named "Sprites", containing 256 grid sliced sprites, and I get this:

    sprites.png

    So they're all just named "Sprites_#", where the # is the order in which they're placed in the sprite sheet (left to right, top to bottom).

    --Eric
     
  3. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    Well in your test both orders are the same. Please try this.
    - If you rename Sprites_255 to ASprites_255 before importing it will be assigned number 0 instead of 255;
    or
    - If you remove Sprites_254 before importing then Sprites_255 is assigned number 254 instead of 255.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hmm...no:

    sprites2.png

    The TileEditor loads the atlased sprites in the order in which they are made by Unity; it doesn't do any sorting. I guess your Unity is rearranging them alphabetically somehow? Not sure how that happens; I can't get it to do that here.

    --Eric
     
  5. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    sorry you are right that is not what caused it.. i am not sure how mine got sorted (it is not even really sorted in meta file)
    thanks
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's pretty weird; I wonder what could sort it like that?

    In other news, SpriteTile 2.5.1 is out:

    TileEditor fixes:
    • Fixed display issues with non-square tiles.
    • Fixed problem when starting for the first time with no TileManager asset.

    --Eric
     
  7. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    actually after further tests.. unity does... if you clear your cache (delete obj, library, etc) after renaming ASprites_255 it works'nt as i said it did'nt and sorts your sprite sheet alphabetically and so SpriteTile imports it as 0.

    - If you rename Sprites_255 to ASprites_255 before *clearing cache* & importing it will be assigned number 0 instead of 255; (Alphabetic)
    - If you remove Sprites_254 before importing then Sprites_255 is assigned number 254 instead of 255. (Packed)

    in these two cases a tile which we both agree (?) should be number:255 is not

    i am just suggesting that if you use (x+y*width) to calculate an id/key instead
    - it would eliminate both of these re-numbering issues
    - it would allow referring to to sprite sheet tiles by x & y in the same way we refer to map tiles.
    - it would allow sprite sheets to evolve over time as different blocks/tile are added/removed without affecting any of the other ids

    or not
    thanks
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I can't use sprite rects for indices; or rather, I did, but that messes up TexturePacker atlases (which can shift sprites around when adding more sprites), so it uses the sprite name now, which is more robust anyway. Thing is, the sprites in an atlas aren't necessarily stored in a grid, and there's no real way for SpriteTile to know if they are. But if you are using a grid, you can refer to tiles by x/y yourself with a bit of math:

    Code (csharp):
    1. var atlasWidth = 10; // number of sprites in a row
    2. var x = 5; var y = 8; var t = new TileInfo(0, x + y*atlasWidth);
    If it would help, I could make a new constructor for TileInfo, where you could set up the atlasWidth beforehand, and then do "var t = new TileInfo(0, x, y)" and it would do the math for you.

    As for sorting, I could add a "sort by atlas location" button. You can theoretically do this yourself now by using the move button, but with large atlases it would be pretty tedious.

    --Eric
     
  9. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    That is the same bit of math I suggested at the start of this conversation.

    The point is that this simple bit of math does not always work because the ids are not always arranged like this. They are sorted alphabetically and packed. Which causes this simple bit of math to not work.

    I have provided two examples of when the math does not work. (renamed tile & deleted tile)
    I have tested this and can provide a example project f you like.

    A possible solution, so the math works, is to not sort (or use the sorted order) and not skip empty tile ids when importing from a grid.

    Thanks.
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    2.5 is on the asset store now! Current changelog for 2.6:

    TileEditor Additions:
    • An "Order" button for showing the order overlay, which shows any non-zero order-in-layer number for each tile (similar to the trigger overlay). This can also be toggled using the keyboard shortcut O.
    • Option to sort tiles by position in tile atlas.

    TileEditor Changes:
    • The "Move Tile" button has been replaced with an "Options" button, which displays a panel with options such as deleting, moving, and sorting tiles.
    • Removed delete tiles keyboard shortcut, since deleting multiple tiles can be done in the options panel.
    • Changed collider overlay keyboard shortcut from O to C.
    • Panning the level view (with Space + mouse drag) is improved.

    --Eric
     
    rakkarage likes this.
  11. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    Hi Eric,

    Very interested in this - was wondering if this works with Unity 4.6? Furthermore, will it be compatible with 5.0?

    Also, does this only work with Unity made sprites? Or can it be used with 2DToolkit sprites? Thanks.
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, it works fine with 4.6 and 5.0. It only uses Unity sprites.

    --Eric
     
  13. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    I've gone ahead and purchased it even though I'm not entirely sure if it will suit my needs - you seem like a good guy.
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Thank you very much. I hope it suits your needs; let me know if there are any features that would be useful to add.

    --Eric
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Probably final 2.6 changelog:

    TileEditor Additions:
    • An "Order" button for showing the order overlay, which shows any non-zero order-in-layer number for each tile (similar to the trigger overlay). This can also be toggled using the keyboard shortcut O.
    • A "Sort Tiles By Atlas Position" button, for sorting all tiles in a set by their position in the atlas. (Does not work if the set contains any single tiles; all tiles must be in an atlas.)
    • Double-clicking a tile in the Level section will select all cells which contain that tile. This is similar to making a selection box--the selected tiles can be filled with another tile or random tile, deleted, alt-clicked to edit trigger numbers etc.--but tiles selected this way can't be copied or made into a group.

    TileEditor Changes:
    • The "Move Tile" button has been replaced with an "Options" button, which displays a panel with options such as deleting, moving, and sorting tiles.
    • Multi-selected tiles can be moved now, so groups of tiles can all be moved at once.
    • Removed "delete tiles" keyboard shortcut, since deleting multi-selected tiles can be done in the options panel.
    • Changed collider overlay keyboard shortcut from O to C.
    • Panning the level view (with Space + mouse drag) is improved.
    • If the TileEditor window is closed when there are unsaved changes to a level, a dialog asks the user whether to save changes or not.
    • If a standard group contains empty tiles, pasting that group into the level will skip the empty tiles, so they don't overwrite existing tiles. Holding shift while clicking will use the old behavior of including empty tiles when pasting. This applies to using a group when erasing as well.
    • Turning on the physics collider default for a tile will also set the collider default, if it's not on already.

    TileEditor Fixes:
    • Multi-selecting tiles in the Tiles section with right-click dragging always works accurately.
    • If tiles have been moved around, multi-selecting tiles copies the correct tiles to the copy buffer.
    • Adding tiles to random groups will work correctly if they've been moved around.

    --Eric
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    2.6 is out! I also added some stuff to the included Gem Hunt demo, which has a webplayer now online here.

    spritetile4.png


    Here's the really final changelog:

    TileEditor Additions:
    • An "Order" button for showing the order overlay, which shows any non-zero order-in-layer number for each tile (similar to the trigger overlay). This can also be toggled using the keyboard shortcut O.
    • A "Sort Tiles By Atlas Position" button, for sorting all tiles in a set by their position in the atlas. (Does not work if the set contains any single tiles; all tiles must be in an atlas.)
    • Double-clicking a tile in the Level section will select all cells which contain that tile. This is similar to making a selection box--the selected tiles can be filled with another tile or random tile, deleted, alt-clicked to edit trigger numbers etc.--but tiles selected this way can't be copied or made into a group.

    TileEditor Changes:
    • The "Move Tile" button has been replaced with an "Options" button, which displays a panel with options such as deleting, moving, and sorting tiles.
    • Multi-selected tiles can be moved now, so groups of tiles can all be moved at once.
    • Removed "delete tiles" keyboard shortcut, since deleting multi-selected tiles can be done in the options panel.
    • Changed collider overlay keyboard shortcut from O to C.
    • Panning the level view (with Space + mouse drag) is improved.
    • If there are unsaved changes to a level, and the TileEditor window is closed or a new level is loaded, a dialog asks the user whether to save changes or not.
    • If a standard group contains empty tiles, pasting that group into the level will skip the empty tiles, so they don't overwrite existing tiles. Holding shift while clicking will use the old behavior of including empty tiles when pasting. This applies to using a group when erasing as well.
    • Turning on the physics collider default for a tile will also set the collider default, if it's not on already.
    • Attempting to load a level that contains missing tiles will no longer fail, but will list the missing tiles in a dialog, and the missing tiles in the level will be shown as a box with an X in it.

    TileEditor Fixes:
    • Multi-selecting tiles in the Tiles section with right-click dragging always works accurately.
    • If tiles have been moved around, multi-selecting tiles copies the correct tiles to the copy buffer.
    • Adding tiles to random groups will work correctly if they've been moved around.

    Additions:
    • TileInfo.empty, the equivalent of TileInfo(0, -1).

    Fixes:
    • Tile.DeleteTile works if there are no tiles in set 0.

    --Eric
     
    rakkarage likes this.
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
  18. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Hi,
    Is it possible tiles to be accessed as an ordinary game objects, i.e. add "custom" components to the tiles i want? Like say tiles that trigger events, or make them interactive on/off switches and such.
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There are built-in triggers that you can use for that (Tile.GetTrigger), so that may be unnecessary. But you can convert tiles to normal GameObjects using Tile.GrabSprite, and the grabbed sprite can have components added to it and so on.

    --Eric
     
  20. Rick-

    Rick-

    Joined:
    Oct 13, 2014
    Posts:
    78
    Hey Eric5h5,i'm very interested in this product!

    Does that have a level generator?
    How does it work?
    Is it flexible?
    Does it work with various tiles?
    Can i still edit the tiles after generating them?

    Thx in advance!
     
  21. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Thank you for your interest!

    It has a level editor, and you can generate levels procedurally using the API.

    You can see an overview here, and read the docs here.

    Very.

    That's the idea. :)

    Yes.

    --Eric
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    By the way, SpriteTile is currently 30% off!

    --Eric
     
  23. Rick-

    Rick-

    Joined:
    Oct 13, 2014
    Posts:
    78
    I'm probably going to buy this asset today,but i have one more question:

    Using the procedural level generator,can i make a terrain somewhat like Terraria and other 2d game terrains?
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sure. This is an example of procedural generation, which is very basic, but it's also only a few lines of code. You can be as complex as you want.

    --Eric
     
  25. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    Sort Tiles By Atlas Position is inaccurate when a tile tile is missing or deleted?

    Code (csharp):
    1. +-+-+
    2. |0|1|
    3. +-+-+
    4. |2|3|
    5. +-+-+
    delete 1

    Code (csharp):
    1. +-+-+
    2. |0| |
    3. +-+-+
    4. |1|2|
    5. +-+-+
    and 2 becomes 1?
    3 becomes 2?

    thanks
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Seems fine here. Did you delete the tile in SpriteTile first?

    --Eric
     
  27. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    ya i deleted the tileSet in SpriteTile first and re-imported. i expect to re-import many times as my sprite sheet changes.
    aha i just noticed that if i do not delete the tileSet first the missing tile is replaced with "(missing)" and the numbering is preserved

    please consider applying this numbering upon initial import too please

    unity sprite editor will exclude empty spaces too when automatically slicing tiles so any tile map with an empty tile with start ordered wrong?

    Tiles.png
    so in this tile set blue is 2 (because unity slices this into 4 tiles)

    Tiles1.png
    and in this tile set blue is 1 (because unity slices this into 3 tiles)

    in order for that math to work the tile position must remain constant and not change based of the state of its neighbors or anything... literally (x+y*width) right? blue is not 1. blue is 2.

    would be nice to not see the empty & missing tiles

    please & thanks
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Since SpriteTile works with Unity sprites, as advertised, I need to rely on the info I get from Unity. Unity is quite flexible about slicing textures in different ways, which is useful but this also means I'm not able to make any assumptions about "missing" sprites, because they're not necessarily organized in a perfect grid.

    So to solve this, I'd recommend putting a dot in the empty square as a placeholder so it's not 100% empty. (Or just fill the background with a solid color instead of transparency.) That way Unity won't omit it and the ordering will always work the way you want.

    --Eric
     
  29. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    could it possibly just be part of the new "Sort Tiles By Atlas Position" option since if you use this option you must be using a grid?
    Code (CSharp):
    1.                            int x = (int)(sprite.textureRect.xMin / _sizeTile);
    2.                             int y = _sizeRow - (int)(sprite.textureRect.yMax / _sizeTile);
    3.                             tempDictionary.Add(y * _sizeRow + x, sprite);
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The problem is that I need sprites to actually pass into the function. If you look at the sorting code you can see it doesn't use a grid, but instead works on the x/y coords of existing rects. As mentioned, there's no guarantee that the sprites are sliced with a grid so it's really not possible for me to assume that they are. Unfortunately making assumptions typically leads to stuff breaking and I really want things to be consistent and work 100% of the time.

    Maybe somebody knows a way to force Unity's sprite slicer to include empty sprites? It seems like it may be trying to be too "smart" in this case. Failing that, I don't think it's much of a burden to avoid completely transparent tiles; just using a background color as the default instead of transparency will accomplish this.

    --Eric
     
  31. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    i don't want Unity or SpriteTile to include empty tiles. they are empty and/or excluded for a reason.

    i am using the transparency in my tiles so i cannot fill or use a different background color.

    we could add thousands of dots to our tile maps but would rather not because
    - i would have to re-slice my tile maps and lose thousands of names or add thousands of dot sprites to the sheet to
    - all these excluded empty sprites would have names and show up in lists and pollute the lists
    - i am still using other tile map systems that don't require you to add dots to all your empty tiles
    - i would like to prevent other and future users from having to do the same
    - but most importantly this math could and should work. since every pixel on the tile sheet has an actual id
    here is my code for turning x/y coords of existing rects into actual ids while ignoring empty tiles

    Code (CSharp):
    1.  
    2. public void Import(DataTileSheet o)
    3. {
    4.     if (o.Texture != null)
    5.     {
    6.         o.Tiles.Clear();
    7.         Dictionary<int, Sprite> tempDictionary = new Dictionary<int, Sprite>();
    8.         string path = AssetDatabase.GetAssetPath(o.Texture);
    9.         object[] assets = AssetDatabase.LoadAllAssetsAtPath(path);
    10.         foreach (UnityEngine.Object asset in assets)
    11.         {
    12.             if (AssetDatabase.IsSubAsset(asset))
    13.             {
    14.                 var sprite = asset as Sprite;
    15.                 if (sprite)
    16.                 {
    17.                     int x = (int)(sprite.textureRect.xMin / _sizeTile);
    18.                     int y = _sizeRow - (int)(sprite.textureRect.yMax / _sizeTile);
    19.                     tempDictionary.Add(y * _sizeRow + x, sprite);
    20.                 }
    21.             }
    22.         }
    23.         var keys = tempDictionary.Keys.ToList();
    24.         keys.Sort();
    25.         foreach (var key in keys)
    26.         {
    27.             o.Tiles.Add(key, tempDictionary[key]);
    28.         }
    29.     }
    30. }
    31.  
    assumptions:
    1. that the tile sheet is a grid.
    - this is a very popular configuration for tile maps?
    - this is the only configuration that allows that math to work!
    - every tile map system i have ever used supports this mode and that math. (tiled, 2dtoolkit, unityTileMap, etc)
    - what is the diff between tilemap and spritesheet? one is arranged in a grid?
    - this is a tilemap system that does not support tiles arranged in a grid?
    2. the size of a tile.
    - the size of a tile can be inferred from existing tiles or set by the user?

    maybe could rename "Sort Tiles By Atlas Position" to "Grid Mode" and ask for a Vector2 tileSize from the user or infer it from first tile. a solution like this will make (x+y*width) work all the time for everyone without modifying source assets at all. without making any assumptions or using anything other then unity sprites.

    please & thank you
    i really appreciate all your help
     
  32. AmefuriSkeith

    AmefuriSkeith

    Joined:
    Sep 26, 2013
    Posts:
    3
    Hi Eric,
    Your plugin look super awesome, I have a question ,
    Did you have a plan to make this plugin support 2d isometric tile in the nearly future? Cause I wonder around and couldn't be able to find a good one anywhere.
     
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you mean tiles like this:

    Screen Shot 2015-01-02 at 11.38.29 AM.png

    Then no, I'm afraid not.

    --Eric
     
  34. BreadWeek

    BreadWeek

    Joined:
    Aug 12, 2014
    Posts:
    45
    Hi Eric,

    I'm liking these updates (oddly, my favorite fix is the space + click dragging in the editor).

    I'm unsure about how to create a one way platform in a 2D platformer. Specifically, a platform that is vertically thinner than one SpriteTile cell that the player can move through when jumping from below but is able to stand on. I'm using physics colliders, but simply turning off the tiles' physics collision layer won't work since the character can at that point float on through walls in neighboring cells. Ideally, I would want to have the one way platforms on a separate collision layer so that I can ignore collisions with only that layer when velocity.y > 0, but perhaps there's another way that SpriteTile can accomplish this?

    Thank you for any and all help.
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I would suggest checking the appropriate tile and using Tile.SetCollider to turn off the collider for that cell when jumping from below, then turning it back on when the player is above it.

    --Eric
     
  36. BreadWeek

    BreadWeek

    Joined:
    Aug 12, 2014
    Posts:
    45
    Thanks for the reply :)

    Unfortunately this brings up a couple more questions. Firstly, turning off a collider when the player is underneath would make it so that all other physics objects touching the collider would pass through. Is there a way to avoid this so that only the player can pass through?

    Somewhat unrelated, if I did want to set a collider to false, I'm having trouble using the Int2 type. I can't get it to reliably find the correct cell based on a Vector2. For example, if a cell is (16, 12) in the editor, in game I'll do a print(new Int2(transform.position)) and it'll print that same cell as being (20, 14) for part of it, and (21, 14) if I move to the right inside of it. changing the tile size and pixels to units makes a difference in this respect but I still can't get a Vector2 to correctly convert to Int2.
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use Tile.GetMapPosition to convert a Vector2 or Vector3 to an Int2 map position. As for the collider thing, how about this: Use GrabSprite to convert the appropriate tile to a sprite, and SetCollider(false) to remove the collider from that cell. The grabbed sprite will have the appropriate physics collider; put the sprite on the desired layer so the player ignores it. Then use PutSprite to convert the sprite back to a tile when needed.

    --Eric
     
  38. BreadWeek

    BreadWeek

    Joined:
    Aug 12, 2014
    Posts:
    45
    Clever! Thank you very much, your continued support is always appreciated.
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You know, I think it would be better if GrabSprite deleted the collider by default, so it wouldn't be necessary to use SetCollider. Can't really think of any cases where you'd want the collider left behind. Next version....

    --Eric
     
  40. hugosslade

    hugosslade

    Joined:
    Mar 24, 2013
    Posts:
    10
    Hey Eric,

    I was wondering what you'd think the best way to get shadows on the tiles. So far I am doing this:
    • Tile.LoadLevel
    • FindObjectsOfType for all SpriteRenderers
    • Setting receiveShadows to true
    • Setting a custom material depending on sortingLayer
    The issue I am having is when a tile is unloaded / loaded the steps I went to to give them shadows are undone.

    Is there a way to enable receiveShadows on the sprites used by a tile by default?

    Additionally a way to Tile.SetTileMaterial with just a set / layer + a material would be useful for overriding materials with custom ones.

    Thanks
     
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The 4 default materials SpriteTile uses can be changed in the Resources folder.

    --Eric
     
  42. hugosslade

    hugosslade

    Joined:
    Mar 24, 2013
    Posts:
    10
    Thanks Eric, that works.

    Is there a way to setup defaults for the Sprites so I can enable receiveShadows? I don't mind changing your code, if there is somewhere to edit you can think of that would be great.

    Love the plugin!
     
  43. hugosslade

    hugosslade

    Joined:
    Mar 24, 2013
    Posts:
    10
    I found it in TileLayer, I added it to the SpriteCached constructor if anyone else is interested
     
  44. Shavik

    Shavik

    Joined:
    Oct 27, 2013
    Posts:
    8
    Any reported issues with Unity 5? I'm using beta 19 and all my layers generated by SpriteTile have "Unknown Layer" on their SpriteRenderer.

    I noticed Layers in Unity 5 don't have numbers so I can't tell if they are in the right order.

    I tried deleting all my sorting layers and recreating 4-5.

    Thoughts?
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, I'm going to have to implement a function where the user supplies the layer names. I know that's awkward and annoying, not to mention failure-prone since it involves strings, but something like that is necessary since Unity doesn't have any way of getting the layer names. (Aside from reflection hacking with UnityEditorInternal, which doesn't work in builds.) Actually maybe it would be better to have a editor utility that gets the names with the afore-mentioned reflection hacking and stores them in a ScriptableObject, which is still less than ideal in many ways but probably less annoying.

    --Eric
     
  46. kregenrek

    kregenrek

    Joined:
    Dec 21, 2014
    Posts:
    10
    Hi,

    Im interested in this plugin.

    Quick question: Is it possible to achieve object collision like in this example:

    (begin 38s -> look at the two blue enemies which colliding)

    I try to track the movement of x enemies and do special behaviour on each enemy if
    they occupy the same tile. Is there any built in method in sprite tile?

    Thank you!

    Regards
    Kevin
     
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, I would probably use GetTrigger/SetTrigger for this sort of thing.

    --Eric
     
  48. kregenrek

    kregenrek

    Joined:
    Dec 21, 2014
    Posts:
    10
    Wow thanks for the quick reply.
    Is there a demonstration for this scenario if I buy your asset? I looked through your documentation
    but it isnt really clear to me.

    I found some old thread were you answered this question with forget physics/raycasting. And I
    think your'e right. So i wondered if your sprite tile could help me to solve this problem. http://answers.unity3d.com/questions/170108/grid-based-movement-collision-detection.html

     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I made a new demo, which you can see here, which has an arbitrary number of moving objects which change direction as needed to avoid hitting each other. It only uses SpriteTile functions (GetCollider/SetCollider in this case), no physics, so it's 100% deterministic, and there can't ever be issues with objects passing though each other so the speed is essentially unlimited.

    agents.png

    --Eric
     
  50. kregenrek

    kregenrek

    Joined:
    Dec 21, 2014
    Posts:
    10
    Hi

    wow thank you for the example above! I bought and downloaded your asset.
    Could you please send me the agent example? I couldn't find it in the SpriteTile Demos.

    Regards Kevin