Search Unity

SpriteTile, a fast dynamic tile system (RELEASED)

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

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Remove the Update function from the level loading script. Update runs every frame, so you're calling functions (which should only run once) every frame.

    --Eric
     
  2. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Okay, thanks for your help :) I fixed the collision detecting bug by just replacing "stevenc.gameObject.layer" with "stevenc.gameObject.transform.position.y < transform.position.y"
     
  3. Kytin

    Kytin

    Joined:
    Dec 4, 2013
    Posts:
    22
    I'm updating to Unity 5 and I'm having trouble. I don't think I missed any steps, but when I attempt to load a level the game hangs. It feels like there is some sort of infinite loop going on in the level loading code.

    EDIT: It might not actually be infinite. I swapped over to using the source files so that I could step through the code. It seems to be stuck in the section checking my terrain sets. It could be that I lost my terrain set data in the changeover. It looks like it is taking so long because it is reporting every instance of the set being missing.

    Ok, I was able to recover my tileset data from a backup I made before updating. That seems to have solved this problem.
     
    Last edited: Mar 17, 2015
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Version 2.8 is available on the asset store, finally. By the way, I was thinking of having a built-in character controller based on the one that exists for the Gem Hunt and other demos...anyone have any requests for any improvements or changes about that?

    --Eric
     
  5. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Different character controllers might be a good addition, but I can't think of anything fancy beyond ensuring it stays in front of specific layers.
     
  6. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    So wait, how exactly would I go about doing parallax scrolling?
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use a perspective camera, then it's basically done for you (have different layers at different Z positions).

    --Eric
     
  8. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    This may be a problem (even though it doesn't really break anything)
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Are you using version 2.8?

    --Eric
     
  10. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I seem to be using version 2.7, so that may be the problem
     
  11. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Hmm... After updating to SpriteTile 2.8, deleting the DLLs, and importing the source, I have these errors (make sure to read all 4)
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Since it says that the type is defined multiple times, I assume you have more than one copy imported.

    --Eric
     
  13. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I deleted everything in my project that had to do with ST, then I re-imported it. I'm still getting some errors, though. (But not the defined multiple times one.)
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Seems to be some kind of Unity error, not related to SpriteTile specifically. No idea what would cause that, I'm afraid, since nothing like that happens here.

    --Eric
     
  15. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Well, it seems that they magically went away. I don't know how or why. Anyways, I have one more error about sorting layers. It's saying I must have 2 sorting layers, but I have 4 (including the default layer)
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Run the Assets / Set SpriteTile Sorting Layers menu item.

    --Eric
     
  17. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Yea, that fixed everything (can't believe I forgot that) Thanks Eric!
     
  18. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    This new version is awesome. Seeing all the layers while editing and making SpriteTile layer not necessarily tied to separate sorting layer is great. This plus per layer controls of physics colliders make SpriteTile much more flexible.

    I intend to use GetTrigger(Vector2) on everything that moves on my level (player, enemies, NPCs) and it will run on every Update/FixedUpdate. Is it ok or it can cause performance issues when ran on update on a lot of objects? I may end up with some pooling for characters but because my coding is not so great Im careful to not do something stupid. The idea is to use triggers as 2d volumes like water, low gravity, wind and so on.
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    GetTrigger is extremely lightweight (it does a bit of error checking on the input values and returns a value from an array), so you should be able to use it for lots of things without problems.

    --Eric
     
  20. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    If you're going to do multiple character controllers I wouldn't mind seeing one that's roguelike. So, basically, block by block movement. Some games do some sort of smoothing in between moves to fancy it up.
     
  21. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's what the character controller in the demos already does.

    --Eric
     
  22. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    Ah, sorry. I'll check those out soon. I've been working on importing maps from tmx files.

    Question -

    When I import a tmx map the collider data for each cell is not set, which one would expect.

    I used the tile editor and set the collider data for each tile. If I draw a tree the collider tint shows up. That's working.

    Is there a way to make the map editor read the collider data I've set on the tiles and apply it to the map I've imported? The same applies to pixel lighting, non transparent, physics collider, etc.

    Edit: When I click on the tint color picker it doesn't seems to allow me to pick a color. It brings up the color picker and I can make a preset but the tint is always blue no matter what I do.
     
    Last edited: Mar 25, 2015
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not currently; I could make a "apply tile defaults on map import" checkbox when importing maps.

    It works fine here.

    --Eric
     
  24. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    Apply tile defaults on map import would be nice.

    I'll fool with the color picker some more. It randomly changed to light gray once but then I couldn't get it back to blue or any other color. I'll try it on some of your demos tomorrow and see what happens. Thanks.
     
  25. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    It does the same thing to me with the Gem Hunt demo. I can't select any collider tint besides blue. It just doesn't acknowledge the selection. Maybe I'm doing it wrong. I don't see an apply button anywhere on the color picker... The eye dropper lets me pick whatever, but the one on the toolbar works at random.

    Dunno. Maybe someone else will have the same problem later. Maybe I'll try a different video card driver.
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Click on the color to open the color picker, choose a color, close the color picker.

    --Eric
     
  27. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Quick question, is it possible to set up lighting to interact with tile maps?
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, see here. You can set up pixel lighting default material for tiles in the TileEditor.

    --Eric
     
  29. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Nothing seems to happen to the tiles with most lights. The only thing that changed them is the directional light, but it lights all the tiles in the map.
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not really sure what to say; it works fine here as you can see from that screenshot.

    --Eric
     
  31. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Yea, that's really weird. I don't exactly know if you set up your light any different than mine. That's too bad .- .
     
  32. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I've been playing around with shaders and such, and I gave the player the same material that the tiles have. And guess what, the light actually lights up the player! :eek: But it still doesn't do anything to the tiles, so I'm not sure if this is a ST problem or not. :/
     
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I would guess you're not using a pixel lighting material for tiles you want to be lit. It's not a SpriteTile problem; again I'd point out this screenshot, which clearly shows that it works:

    spritetilespotlight.jpg

    --Eric
     
  34. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I did have them set to the pixel lighting material, though. :/ (For all of my 3 tiles)
     
  35. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    557
    @Eric5h5 Love the asset. Is there any way to store more information in a tile aside using a simple trigger byte value?
    I am trying to link maps using information stored in the tile map, but I have to create multiple layers to do this. A layer that consists of triggers only creates additional unnecessary game objects. If there is not another way to store tile information, is it possible to add my own object to a tile, just to store information about it.

    For instance, I want to link tile maps together using information stores in tiles. I also want to place enemies in a map using information provided by the map itself.
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could always have an array that you create yourself, where each entry corresponds to a tile.

    --Eric
     
  37. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Is there a way to apply physics colliders from object to multiple tiles? If there is no such option it would be great to have some way to apply custom colliders to many tiles at once. Its not such a problem to do it once even for several spritesheets with hundreds of tiles, but it will become a problem to do it after each reimport of a spritesheet (like inserting new tiles and/or rearrange tiles order in a sheet).
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Physics colliders are for a single tile, but inserting new tiles or rearranging them doesn't cause any issues and you wouldn't need to do it again.

    --Eric
     
  39. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    What I mean is when iterating spritesheet images and trying better sheet configurations. Unity free doesn't support sheets from multiple files. Ill give an example: I used the default config of 1024 sprites per set. Now im few sprites short of 1k sprites. This means that very soon ill have to split the spritesheet image in 2 parts with say one for foreground sprites and others for background ones. I suppose that fixing the level will be possible thanks to the SpriteTile's option to select/change all identical sprites in a level. But setting up colliders one by one again is not optimal.
     
  40. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It does, assuming you're using Unity 5. But if you're talking about moving sprites between different sets entirely, then yes, you'd have to set them up again. So you mean multi-selecting tiles and having the "from object" button apply to them all?

    --Eric
     
  41. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Yes, just changed to Unity5 few days ago. So they enabled multi-files spreadsheets in Unity5 free? Thats great.

    Exactly - I mean selecting multiple sprites/tiles in Tiles section of SpriteTile (with Shift and/or Alt) then Physics collider -> Custom -> From Object. And the same collider to be applied to them all.
    I don't want to rely on auto because Unity often creates weird collider shapes caused by the low res pixel art.
     
    Last edited: Mar 30, 2015
  42. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    557
    If there is any room for feature requests, I would like to be able to simply store user data in the form of a byte[] in the (bytes files). SpriteTile doesn't really even have to do anything with it. As it stands, I need two files per map to store any relevant data. The ability to store this in the same file (and be ignored) by SpriteTile would be great.

    If you are feeling adventurous, user data could simply load along with the map and accessed through a List<byte>.

    This is just food for thought though. This is a great asset.
     
  43. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I think it might make more sense the other way around...store the user data as you like, and append the SpriteTile data to that, so you have one file.

    --Eric
     
  44. SiliconAvatar

    SiliconAvatar

    Joined:
    Mar 23, 2014
    Posts:
    50
    If I click the eye dropper next to the tint color box and mouse over to one of my tiles (carefully avoiding the map editor, which makes the color pick fail) I can successfully choose a color off a tile.

    That's my work-around if anyone else has the same problem.
     
  45. Ivanskodje

    Ivanskodje

    Joined:
    Mar 29, 2015
    Posts:
    57
    Is SpriteTile fully compatible with Unity 5 yet?

    I have read some info about it and seen a few screenshots, but have yet to see it in action :)
     
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, it's compatible with Unity 5 and was submitted to the asset store with Unity 5 (and Unity 4).

    --Eric
     
    Ivanskodje likes this.
  47. MaddoScientisto

    MaddoScientisto

    Joined:
    Jan 30, 2015
    Posts:
    62
    In my game I'm using a character controller which relies on objects with colliders having a specific layer set to differentiate platforms, moving platforms, etc.
    This controller only treats objects with the layer set as "platform" as eligible for collision and because of this the character would fall right through a spritetile level even though I set the tiles to have a collider.

    Is there a way to set the layer of the tiles with colliders to platform? The character controller can not be easily changed to handle collision on other layers as it would break the moving platform functionality
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sounds like you want Tile.SetColliderLayer.

    --Eric
     
  49. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    There's a problem whenever I try to build my project. (Note: I changed the .NET 2.0 subset to just .NET 2.0 in player settings> optimization) I get a few errors about the DLLs. (This problem happens with using the SourceCode and the DLLs.) I've been looking around in Unity Answers, and this is usually caused by having plugins. But all the "fixes" are usually just for the Android plugin thing (I don't do mobile dev) If it would help, here's the errors.

    Link to errors

    To be honest, I'm not even sure if SpriteTile is causing these. (Even though ST is my only plugin) So if you don't think it's SpriteTile, just tell me. I'll try fixing it myself. Thanks anyways
     
    Last edited: Apr 5, 2015
  50. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It doesn't seem to be related to SpriteTile, sorry.

    --Eric