Search Unity

SpriteTile, a fast dynamic tile system (RELEASED)

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

  1. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    hi does it support transparency? like if i have a tree would the ground show through the tree? if so how is it done?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    SpriteTile uses sprites, so if you want transparency you use the standard techniques you'd use for any texture.

    --Eric
     
  3. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    Hi im trying to get this to work with mutliplayer but it does not seem to work as the player is instantaited with it camera after map it called what can i do to work around this?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Can you set up the camera first, and then add the player later?

    --Eric
     
  5. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    well each player has a a seperate camera and it is parented to them so i dont think could do that
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use multiple camera with SpriteTile; see the "setting the camera" section in the docs.

    --Eric
     
  7. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Probably the one thing on the asset store I genuinely want
     
  8. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Hi, I just bought this but am running into an issue right away, I searched through half the pages on this forum but didn't notice anyone else having this issue.

    I'm using a spritesheet of 16x16 tiles, with unity set to 16px per unit. (I've also tried 32x32, with 32px per unit similar to the demo)

    For the demo tiles, when mousing over the tile editor map, the 'shadow' of the tile is perfectly square with the grid, however with my tileset, it's centered in the middle of 4 grid squares on the tile editor.

    I've tried all kinds of different settings over the last few hours, but nothing I've tried has been able to work.

    Attached are the working and problematic screenshots of my issue, any help would be really appreciated!

    P.S. I went through the documentation, but nothing stuck out as related to this, though maybe I'm blind, sorry if so!
     

    Attached Files:

    Last edited: Mar 3, 2015
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It looks like you have the pivot for the sprite set to something other than centered.

    --Eric
     
  10. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    I'm splicing the sprites using the build in Sprite Editor, so Sprite Mode: Multiple, in the settings there the pivot is set to the default (center)

    Edit:
    Ah! Sorry, this was my mistake, I was verifying the settings by clicking Sprite Editor, which in the slice drop-down was saying center, however when I click on the actual tile I see they did slice as Top-Left

    Thanks for the help!
     
    Last edited: Mar 3, 2015
  11. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    One thing I noticed for the tile picker, is when right-clicking and selecting a group of tiles on the right-side of the window, it's offset by 1 tile to the left.

    If I select a group on the left half though, the correct tiles are selected.

    Attached are screenshots of the selection, and then what actually gets selected.
     

    Attached Files:

  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You're right; sorry about that. I'll fix it.

    --Eric
     
  13. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    Hi i still cant get multicamera to work i have them tagged and when another player joins he takes over as the map generator and the old is left with no map
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Did you set up the cameras first?

    --Eric
     
  15. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Thanks!
     
  16. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    the cameras are on the player i then instantiate the player and enable the camera
    edit i forgot about the if photon veiw is mine
     
    Last edited: Mar 4, 2015
  17. xeroin

    xeroin

    Joined:
    Sep 16, 2013
    Posts:
    3
    I seem to have a problem with unity 5 and spriteTile 2.7, setting the collider layer with Tile.SetColliderLayer(). Only the first collider in the list will get the correct layer, the other colliders in the list will be on the default layer.

    Btw using The Physics collider option
     
    Last edited: Mar 4, 2015
  18. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    Hi im trying to place a tree ontop of the base grass tile but it over rides it how is this done
     
  19. vicenterusso

    vicenterusso

    Joined:
    Jan 8, 2013
    Posts:
    130
    Does it support corner/edges detection to change graphics while drawing? And sprite variations?

    Thanks
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The cameras should be set up first.

    Good catch; that does work in Unity 4. As a workaround for now, use Tile.SetColliderTag ("Untagged") before calling SetColliderLayer.

    Use separate layers, where the tree layer would be on top of the grass layer.

    That sounds like the terrain group feature, so yes.

    Could you explain what that is?

    --Eric
     
  21. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Would you be able to add support for CTRL+Clicking to add a tile to the currently selected tiles?

    I.e., I select a rectangle of 3x3 tiles, then CTRL+click to add other tiles beside it, so that I can paste non-rectangular shapes in one shot. It's a feature I used in Tiled, but didn't notice it here, I find it really handy. (also useful for selecting/creating random tile groups or pre-selected groups in the bottom-right window)

    Attached is a demonstration of what I mean.
     

    Attached Files:

  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sounds reasonable.

    --Eric
     
  23. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    This first one is huge one for me:
    Is it possible to add some way to see more than 2 layers (current + prev/next) while editing? Probably some tag list to enable visualization of all the needed "non-active" layers. Currently its somewhat difficult to navigate constantly between several layers just to make sure you draw in the right place and that all fits. (Previewing in the view-port is even slower and not an option.)



    Next 2 are small inconveniences as they can be done "manually":

    It would be good to have an option to assign different game object layers to the physics trigger/colliders for each sorting layer (instead of single GO layer for every physics collider on the level). Not big deal as long as there is a way to distinguish different physics trigger/collider layers. I'm currently using - if (gameObject.name.StartsWith("Collider 0")) and so on for Collider 1, 2, 3.

    I don't know if its intentional or not, but SetLayerPosition moves only sprites and not physics colliders.
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That also sounds reasonable. But it's intentional that SetLayerPosition only moves sprites since it was intended as a visual effect for background layers which wouldn't normally have colliders.

    --Eric
     
  25. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Another feature request, could we have preview default to previewing the entire map if there is no selection? Instead of having to make a selection and then preview it.

    Edit: i.e., if nothing selected, then 'this layer' and 'all layers' will still be enabled, but will auto-use the entire map
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, select all exists and is easy enough to do (alt-A), so I'm not sure that's really needed.

    --Eric
     
  27. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    I didn't realize that was there, I had been trying CTRL+A, time go looking through the documentation for all the hotkeys, thanks!
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There's a separate guide that lists them all on one page. :) I used alt a lot so as not to conflict with Unity keyboard shortcuts, which are still active when the TileEditor window is being used.

    --Eric
     
  29. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    I actually move the whole level - all layers plus trigger/collider parent object. My 2D Raycast based character controller doesn't coop well with negative numbers. After I load a level i move it by +1/2 cell on x and y to align bottom left of cell(0,0) with unity's 0.0. Maybe a method to move the whole level? But still not something super important that cant be dealt otherwise.
     
  30. vicenterusso

    vicenterusso

    Joined:
    Jan 8, 2013
    Posts:
    130
    @Eric5h5 When I said sprite variations means that a specific corner sprite might have another variation (with a small difference on the graphic) and be drawed randomly, like this:

     
  31. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It does have random groups, yes. See the "groups" section in the docs.

    --Eric
     
  32. MetalStorm80

    MetalStorm80

    Joined:
    Feb 24, 2015
    Posts:
    11
    I have a few questions again, as well I agree with the person posting above that a feature to see the map with all layers enabled would be great as I find I am constantly going back and forth between layers so I ended up just using Tiled to make it.

    First issue I just started having, all of a sudden my maps only load the first layer in game. Is there a setting that would cause this? I did not change anything that I know of, I was messing around in code trying to set it up so that when the player hits a trigger it would load a different map and move him to a set location. As far as I know I did nothing in the spritetile editor but now whenever I run my game I only get the layer 0 objects so just the main map and terrain but nothing over top of it (trees, mountains, bridges, etc which are on other layers).

    Any idea what could cause that to happen? I have looked through all the documents and dont see anything.

    One thing I did notice is in the editor viewing my map when it is set to layer 0 show preceding and show next are both greyed out which I find kind of, before only show preceding was greyed out (there is obviously no preceding on layer 0).


    The other question I have is about loading a map and moving the player to a set location on it. I have it working where it will load the maps back and forth when going over triggers but it does not move to the location. If the location that you are at on the map exists in both maps (ex both maps have tile location 120,120) then you will show up at the same location. If the location does not exist I will get an error in unity showing up saying out of range for the map (sorry dont remember the exact error and dont have it available at the moment).

    Here is the code I have for it so far, I have tried doing the move before and after loading the new level but it has the same issue.

    getTrigger = Tile.GetTrigger (transform.position);
    if (getTrigger == 1)
    {
    Tile.LoadLevel (WorldLevel);
    var worldPos = Tile.GetWorldPosition (new Int2(10, 229));
    transform.position = worldPos;

    }

    Any tips?
     
  33. MetalStorm80

    MetalStorm80

    Joined:
    Feb 24, 2015
    Posts:
    11
    Just to add on the above, when I run the game and spritetile adds everything to it I do actually see the SpriteTileLayer's in the hirerarchy window
     
  34. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    Adding on to the post above... it would be cool to know more about how the SpriteTile map layers correspond to the layers in the Unity Editor. It would be awesome if we could manually specify the Unity layers to use for the map layers... like for each map layer a drop down showing all available layers just as it does in the Unity Editor and we can simply choose the Unity layer we want to use for this map layer... but I didn't see anything like this. Is it possible?
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That sounds like maybe you accidentally deleted the other layers somehow?

    I'd recommend Tile.GetMapSize, where you would use that to clamp coords so they don't go out of bounds for the current level.

    tileeditornew.png

    --Eric
     
  36. MetalStorm80

    MetalStorm80

    Joined:
    Feb 24, 2015
    Posts:
    11

    The layers still show up in the editor though, if i click the drop down and switch between all of the layers they are still there. but when I run the game it is only the first layer that shows up.

    Sorry I guess I didnt word the other issue well. With moving to different co-ords after I load a different map it still does not move the player to that position. It loads the new map/level in and that part works but the player will still load in at the same spot he was at on the previous level.

    If I use the same code to move the player to a new position on the same level it works fine, its only when I change the level to a new one I have the issue. It is a 2d top down rpg style game so when I load the new map in I need to make sure he is at the correct spot (town, dungeon entrance, etc).

    I will keep playing with that one and I am sure I can figure it out but the issue with only the first layer showing up in game really confuses me.
     
  37. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    Hmm... I am guessing there has been an update since I last grabbed SpriteTile.

    Because I see this:


    I will check for an update. Thanks!
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hmm...maybe you moved the layers on the Z axis so they're not in the camera frustum?

    I expect it's not moving because of the error you mentioned, so if you clamp the coords to prevent going out of bounds and thus preventing the error, it will work.

    Not yet. ;)

    --Eric
     
  39. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    LOL! I grabbed it again and discovered yes I do have the latest. Great to see the feature is on its way! Thanks!
     
  40. MetalStorm80

    MetalStorm80

    Joined:
    Feb 24, 2015
    Posts:
    11
    I havent figured out how to fix it but figured out the cause of not being able to move the character. Its something in my character controller script causing the issue. I will find that on my own but still no idea on the layers issue.

    I checked the Z axis and they are all at 0, I tried moving some of the 'top' layers to different Z levels and still the same problem.
     
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'm afraid I'm running out of ideas...do the layers show up in the hierarchy?

    Screen Shot 2015-03-09 at 3.26.30 PM.png

    --Eric
     
  42. MetalStorm80

    MetalStorm80

    Joined:
    Feb 24, 2015
    Posts:
    11
    yes all of them do show up in the hierarchy. The other level works fine and everything looks the same settings wise (it was working before as mentioned above so the import went fine). I tried while the game was running adjusting the z values for the layers in the hierarchy just to make sure they were not underneath and no change. If I adjust the layer0 the terrain of the map will dissapear as it should but then adjusting the other layers does nothing.

    I am still really early in my project and just fixed a few other bugs so it is not that big of a deal to start over at this point but figured I would check if its something simple.

    if you have any other ideas I am open to trying anything.
     
  43. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    My last idea is that maybe you're moving the layers so they're not visible in the camera?

    --Eric
     
  44. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    SpriteTile 2.8 is out! Will submit to the asset store next.

    Additions:
    • Tile.SetLayerSorting function, which sets a SpriteTile layer to a specified Unity sorting layer (either by index or by name).

    Changes:
    • Tile.GetMapPosition is changed to Tile.WorldToMapPosition for the sake of greater clarity and consistency with Tile.ScreenToMapPosition.
    • For the same reasons, Tile.GetWorldPosition is now Tile.MapToWorldPosition.
    • Tile.SetColliderMaterial, Tile.SetColliderTag, and Tile.SetColliderLayer can optionally specify a layer.
    • Tile.SetLayerPosition can optionally specify whether to also set the position of colliders for that layer.

    Fixes:
    • Tile.SetColliderLayer will work in Unity 5 without having to use Tile.SetColliderTag first.

    TileEditor Additions:
    • A "Sorting" popup menu, so each layer can be assigned an arbitrary Unity sorting layer.
    • In addition to the show preceding/next layer options, there's now a show all option, which shows all layers, as long as they have the same dimensions as the current layer.
    • Added "All" button (next to the deselect button) for selecting all tiles in the layer. This is the same as what the alt-A keyboard command does.
    • Alt-clicking on a tile in the Tiles section will add it to existing multi-selected tiles, or remove it if it's already selected. This can be used in combination with right button drag-selecting.

    TileEditor Changes:
    • Selected tiles in the Tiles section are much more obvious when using the Unity editor dark skin.

    TileEditor Fixes:
    • Fixed issues with right button drag-selecting in the Tiles section.

    --Eric
     
  45. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    For some reason, the tile layers won't assign themselves to other sorting layers. I'm guessing it's just because I might have set them up wrong, but I followed all of the instructions in the documentation. Help?
     
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'm not quite sure what you mean by that, but did you use the Assets/Set SpriteTile Sorting Layer Names menu item?

    --Eric
     
  47. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Yes I used the Set SpriteTile Layer Names, and what I mean is this:

    In the documentation, it said to make multiple sorting layers for multiple layers in the tile editor. I was thinking that "Oh, if I put tiles in this new layer, then in their sprite renderer it should say "Sorting Layer = "MyLayer""" ..Or something like that. I really just need this for my collision detection. But, if there's a way to give them all a tag, that'd work too. Sorry if I'm not exactly making sense or SpriteTile doesn't support this. Thanks ^ )^
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can do that (the sprite renderers do say which sorting layer they're on), but for collision detection you normally use GameObject layers, which you can do with Tile.SetColliderLayer.

    --Eric
     
  49. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Thanks so much! It works perfectly now, you're great c:
     
  50. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Actually, now the player will only detect collisions with one collider object, and nothing else.

    So say if he goes and touches that little bump right there, he won't be able to jump anymore. If it helps, here's my movement script that handles ground detection. [Script] [Level Loading Script] This is either a bug, or just my ignorance. (I'm guessing it's that second possibility cx)