A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by Eric5h5, Dec 11, 2013.
Will this demo be included in the 3.0 package?
Yep, plus a couple of other new demos.
Version 3.0 looks incredible Eric5h5, especially allowing custom properties for tiles. Opens up a ton of potential
I'd like to point out one small bug that's appeared in Unity 5.5 (it is possible this bug was present before, I hadn't noticed). In the TileEditor window, the Tint button is almost always highlighted. This is an issue when using the spacebar to move around as the spacebar will select the Tint button, opening a color picker. I can use ctrl+spacebar to move fine, but since input in the TileEditor window can be a little sluggish while zoomed out that method occasionally results in a line of deleted tiles as SpriteTile believes I've ctrl+clicked.
For whatever reason, the Tint button is not highlighted while the TileEditor is on my second monitor and my mouse is on the lower ~sixth of the drawing window. I'm sure that's very helpful... Anyway, not a huge issue and potentially not universal but can be a little frustrating.
I see what you mean...no idea why that would happen in Unity 5.5 (it doesn't with earlier versions), but it doesn't happen with SpriteTile 3.0, so whatever changes I made apparently fixed it. Which is good.
Here's another WebGL demo, where the new tile property system is used to place GameObjects in the level, in this case moving platforms, where the speed for each one is different, based on the number property (a float; also you can use strings).
The level section of the editor also got a bit of an overhaul, since with the addition of the light controls, it was maybe starting to look a little intimidating at first. So the sections can be collapsed, which reduces the controls to just a few of the most-frequently used ones.
Getting very close now!
Version 3.0 is done! Available on my website, and will submit to the asset store shortly. Here are the final release notes:
• Tile.SetLight, for instantiating a light style at a specified position and setting its light intensity. Light styles can be added with AddLightStyle or loaded along with a level made in the TileEditor.
• Tile.DeleteLight, for removing a placed light.
• Tile.MoveLight, for moving a light from one tile to another.
• Tile.RefreshLight, to recompute a shadow-casting light in case any colliders in the light radius are changed.
• Tile.HasLight, which returns true if a cell contains a light and false otherwise.
• Tile.GetLightStyle, which returns the light style of the specified light instance.
• Tile.GetLightIntensity, which returns the intensity of the specified light instance.
• Tile.GetLightPositions, which returns the Int2 positions of all lights in a layer.
• Tile.AddLightStyle, for adding a light style with various properties (size, color, etc.) that can be used with SetLight.
• Tile.RemoveLightStyle, for removing a specified light style, and all lights that might be using it.
• Tile.ChangeLightStyle, which changes the properties of the specified light style, and all lights which might be using it.
• Tile.SetAmbient, which sets the ambient light (base color for all tiles) for a layer.
• Tile.UseRadiosity, which indicates whether shadow-casting lights should use a radiosity effect or not.
• Tile.AnimateTilePosition, for animating a tile at a particular (x, y) position. (Contrast with Tile.AnimateTile, which animates all tiles of a particular kind.)
• Tile.StopAnimatingTilePosition, which does what it says.
• Tile.WatchTile, for watching the position of a tile and calling a function if that position comes into or goes out of view of a camera. Similar to OnBecameVisible/OnBecameInvisible Unity functions.
• Tile.StopWatchingTile, in case you don't want to watch a tile anymore.
• Tile.GetProperty, for getting optional tile properties, namely number (float), label (string), and GameObject (prefab).
• Tile.SetProperty, for setting an optional tile property.
• Tile.RemoveProperties, for removing all optional properties a tile might have.
• Tile.HasProperty, which returns true if a cell has any optional properties and false otherwise.
• Tile.GetPropertyPositions, which gets a list of all tile positions that have an optional property
• Tile.SetColliderTrigger, for setting the isTrigger value of tile physics colliders.
• Tile.SetMapBlock now has an optional "instantiateGameObjects" parameter, which if true causes the appropriate GameObjects to be instantiated for any tiles in the block with a GameObject property.
• Files saved with SpriteTile 3.0 are version 4 now. SpriteTile 3.0 will load files from older versions, but older versions will not be able to load files saved with SpriteTile 3.0 or later.
• Tile.SetColliderLayer (and Tile.AddLayer) uses any defaults that have been set up with Tile.SetColliderMaterial, SetColliderTag, and SetColliderTrigger.
• Tile.useTrueColor is true by default.
• Tile.SetMapBlock updates physics colliders correctly.
• Fixed cursor texture console warning with Unity 5.4.
• Fixed bug that could cause visible tiles to not be updated after being changed, when using multiple cameras.
• Removed GC that would occur when using tile materials.
• Compatible with Unity 5.5.
• Lights section, for managing different styles of lights and their properties.
• Light Mode button for adding/deleting/moving lights.
• Light overlay toggle for showing lighting in the level.
• Extra overlay toggle for showing any tiles that have an optional property (number, label, GameObject).
• Redo button
• Pick tile button (does the same thing as the P shortcut key).
• The Level section has been reorganized to add a Tools box, and the Layer, Light, and Selection sections can be individually collapsed, in which case only a few of the most commonly used controls for that section are visible.
• Setting tile properties now has the ability to set extra properties (number, label, GameObject).
• Other improvements for the tile property editing area, especially when multiple tiles are selected. Most notably, multiple tiles with differing properties use multi-editing like in the Unity editor. Properties displayed as "—" aren't changed when finishing the edit, which allows applying a specific property to multiple tiles while leaving other properties alone.
• When using a selection box to select multiple tiles in the map, the info box X and Y coords change to W and H (width and height), to show the size of the selection.
• There's now a custom cursor for drawing with an active random group, to make it more obvious.
• If tiles are deleted from the project without deleting them from the TileEditor first, opening the TileEditor presents a dialog with the option of deleting them from the TileEditor.
• Prevented undo list from being added to indefinitely; oldest elements are removed if it gets huge enough.
• "Move To" button doesn't overwrite the destination layer with empty tiles, unless shift is held down while clicking, making it consistent with pasting the copy buffer. This also makes it easy to merge layers where the source layer has empty tiles.
• "Move To" button requires two undos to completely undo the action.
• Internally, the level is no longer inverted to accommodate the top-down coords of editor GUI code, but instead the drawing logic is changed to correctly handle levels without inverting them. This has no effect on usage, but anyone who has made changes to TileEditor source code should be aware.
• When loading standard groups from files that were saved with version 2.12 or earlier, groups have a tile size assigned using the tile size of the current layer, in order to prevent errors. In cases where the current layer tile size isn't the correct tile size for the group, the groups should be recreated and re-saved.
• Fixed error that could occur in certain cases when multi-selecting tiles in the Tiles section by drawing a selection box.
There's also a quick start guide included now for new users. Here's another little demo, this one for endless scrolling. I've had a number of inquiries about that, so this is one way to do it. Not really a lot to look at; it's more about the code, where it takes a level that's divided into sections:
and programmatically makes each section loop seamlessly until you want to advance to the next section.
Wow, a lighting system and properties! I can't wait to try this out. Thanks very much for the update.
FWIW, probably a moot issue now, but I also have the issue with the SpriteTile 2.x window not showing up in the list on 5.5, in both fresh and old projects. When loading a project saved in 5.4, the console gives the error "Error while reading window layout: window #13 is null". It's late now but I'll try upgrading to 3.0 tomorrow.
Yes, the issues with the TileEditor in Unity 5.5 are fixed with SpriteTile 3.0.
Any idea when 3.0 will go live on the asset store?
That's up to the asset store reviewing team. Not that I would ever suggest anything underhanded like bribing them to make it go faster, but you could try bribing them.
No bribes needed it would seem; 3.0 is on the asset store now.
The lighting system is awesome! I would love to use it as a fog of war mechanic to obscure sprites on the other side of tile colliders but I'm not sure how one would implement that. I assume that with a better understanding of shaders (I currently have ~0 shader knowledge) this would be a simple answer but otherwise there is no way for a light to clear out a top "fog" layer, correct? Am I over complicating things?
Thanks! Actually there are no shaders involved; the lights set tile colors which can be read by Tile.GetColor. So that's a possibility: you could set a light and then use GetColor and SetColor to assign the tile colors. However, it's probably simplest just to keep adding lights, since there's no performance hit.
Thanks as always for the quick reply though I'm not sure I fully understand it or made myself clear
I'd like to implement a fog layer of black tiles above all the others to obscure everything under it and have a light apply transparency to these tiles (i.e. an intensity of 1 would set the tile's alpha to 0). This way the lights could be used to cast shadows on every sprite in a scene, not just tiles. I can probably accomplish that in the source by changing a tile's alpha instead of calling ColorBlend() (and maybe that is what you were referring to) but I feel like there's a much simpler answer that I'm not seeing...
I was assuming you'd set the layer ambient to black, so you wouldn't need a fog layer as such. You can use GetColor so that independent sprites are set to the appropriate tile color (the elevators in the Property demo do this). I don't really see any feasible way of using shaders for this. As for colliders, physics colliders have just one layer, however tile lighting doesn't use physics colliders, it uses tile colliders, which are separate for each layer (i.e. Tile.GetCollider).
Haha I coincidentally just remembered that tile colliders were a thing and edited my post, I've only ever used the physics colliders. Thank you Eric, this has cleared things up
@Eric5h5 - I recently upgraded to the most recent version of SpriteTile due to the menu for the editor disappearing. After upgrading, I experienced a lot of issues upgrading. I ended up wiping out everything from SpriteTile and reimporting. I think it is mostly working, but I'm running into a curious issue with a call to SpriteTile.Tile.SetTileMaterial. I'm passing it a legitimate material (confirmed not to be null) but I'm receiving:
NullReferenceException: Object reference not set to an instance of an object
SpriteTile.Tile.SetTileMaterial (UnityEngine.Material material)
I honestly don't know what to make of this. I'm using the DLL version. I also have a back-up of my project with the old version of SpriteTile, so if there was a fixed DLL to make the editor appear in Unity 5.5, I'd accept that as well.I was on SpriteTile 2.12 on the old version. Other calls into Tile.(whatever) aren't throwing errors.
I honestly don't need the new features, I just need this working again so either path is fine for me. Thanks!
Moving that call to after the LoadLevel call fixed that issue, but now the tile is rendering at a different layer/position ingame and above the player/objects. I'm also seeing a pink background on previously transparent tiles as well. What would be the correct way to address those two areas? I tried some of the functions referencing layers, but I couldn't make them work properly.
Otherwise, a working DLL for 2.12 would be easiest. If I can just get into the tile editor, I'm happy to stay on that version. Thanks!
Yes, Tile.SetTileMaterial is intended to be used after a level is set up; for the next version I've added proper error checking in that case so you don't get a null ref error. Thank you for reporting this. I'm not quite sure what you mean by "the tile is rendering at a different position" since SetTileMaterial (Material) applies to all tiles and wouldn't change their positions. Can you elaborate? Pink textures usually indicate some kind of issue with missing materials; is this related to a Unity upgrade? You may need to check your shaders and make sure they're compatible. In any case I wouldn't recommend staying on 2.12 because of bug fixes.
Yes, this was all from upgrading to Unity 5.5 and the SpriteTile Editor disappearing from the menu.
Sorry, the depth position of the tile wouldn't be related to the material. But after the upgrade, the tiles appear on top of objects that they were previously under (i,e. the tile map is covering up the player). What is the right way to set the layer/sorting layer/etc... of the tiles so they appear below players and objects? I tried some of the functions with layers in their names, but they didn't seem to work. What is the proper way to set that across all tiles?
As per the shaders, I'm just using the same shaders that I was previously. Would anything have changed with them that transparent tiles would now suddenly be pink?
Also just in the meantime, if you did have that fixed .dll for 2.12 to show the level editor in Unity. it would be exceptionally helpful until I can work through all of these upgrade issues. Please provide that if possible.
Tiles use layers the same as regular sprites (since that's what they are), so everything about sorting layers and order-in-layer sorting applies to SpriteTile. I would guess that the sorting was previously undefined, so it just happened to seem like it worked, but any changes like upgrading Unity causes it to "break", so the solution is to set up explicit sorting. I'm not aware of anything that could cause transparent tiles to be pink; there's not really anything in SpriteTile that would do that as far as I know. If you have an example project that shows this issue, I can take a look.
What is the correct API call to set the sorting layer for all tiles? That's probably the best place to start then.
In the TileEditor, the order property sets order-in-layer sorting for individual tiles (see also the Order Fill feature). In code, that's Tile.SetOrder. Sorting layers are set up in the Layer section; see the How Layers Work section in the docs. So there are two elements to sorting; order-in-layer is for sorting sprites that share the same sorting layer.
Thanks for your help @Eric5h5 . I was able to resolve my issues. SpriteTile remains awesome as ever!
Anybody have any idea how to implement tile event click?
I'm trying get the game object name of the tile clicked, but is not working.
GameObject go = Tile.GetProperty<GameObject>(new Int2(4, 47), 1);
Anybody knows how to get the game object of the tile?
There isn't any GameObject linked to a tile, since tiles are abstract data and the objects used for displaying them are recycled as the camera moves. GetProperty<GameObject> is only for when you explicitly use SetProperty<GameObject> or assign a prefab in the TileEditor.
So the only way is create a prefab for each tile that I want add a click event?
What actually are you trying to do? I mean, the end goal.
Sorry I'm new in unity,
So, I draw my grass in layer 0
and the dirt in layer 1
I would like to click in dirt and show Debug.Log("message");
I have tried using:
Vector3 x = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Int2 pos = Tile.WorldToMapPosition(new Vector2(x.x, x.y), 1);
// achou o trigger no layer 1
if (Tile.GetTrigger(pos, 1) == 1)
But the problem is, when I have UI on top, when I click in my button, I also see the debug message.
So I was thinking if is possible add a click event inside the tile, so I can avoid this problem.
Not sure if is the best way to do this. :/
So you want the UI to block clicks? I would suggest setting a boolean if the UI is clicked, and checking that in the code.
if (Tile.GetTrigger(pos, 1) == 1) && !UIWasClicked)
OMG yes thanks
if (Tile.GetTrigger(pos, 1) == 1 && !UICamera.isOverUI)
I create a simple camera move using the arrow keys, its working, but I would like to lock my camera move to the size of my map. This way the camera will be restrict to corner of the map.
Anyone have any Idea how to do it?
private void MoveCamera()
float speed = 3;
transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0));
transform.Translate(new Vector3(-speed * Time.deltaTime, 0, 0));
transform.Translate(new Vector3(0, -speed * Time.deltaTime, 0));
transform.Translate(new Vector3(0, speed * Time.deltaTime, 0));
I'd recommend using Tile.GetMapSize, for example the bounds set in the Manager script in the Acorn Antics demo.
I just bought this tool and opened it in a (mostly) empty project, and have a minor bug: in the "Quick Start" document, the first thing it suggests is setting up layers, and "select Set SpriteTile Sorting Layer Names from the Assets menu". But there's a necessary step before that: open TileEditor from Window (from what I can tell, you don't have to actually do anything in it, just open it). Until you do that, you get an error message setting sorting layer names.
Good point; I've added that step now. (See here for the updated version.) Thank you!
Now on sale for 25% off!
Hi! Just wanna say that I'm loving your Editor so far! Haven't had any real issues, but I did notice something that is kind of annoying. When you are editing the colliders in the level, the mouse sometimes moves erratically. Like I could be moving it straight down and suddenly it veers to the right. I thought I just kept slipping a lot until it kept going right after I took my hand off! This may be related, but not sure, I recently got a second monitor, and when trying to edit the colliders with the editor window on my secondary monitor, the mouse shoots completely out of the window. I can't even mouse over to the collider check box to turn it off. Otherwise, great job, it has made so many things much simpler.
Thank you! As for editing colliders, that's pretty bizarre...as far as I know it's not even possible for code to set the mouse position so I'm not sure what could cause that. Can you try disabling the second monitor temporarily to see if it still happens?
Oh it was happening before I got the second monitor. Just the second behavior, where the mouse gets pushed out of the window, wasn't happening until I got second monitor. I could do a screen capture maybe and show you, but I don't know how helpful that would be.
Hmm, in that case I don't really know since that definitely doesn't occur here. There's no API for moving the mouse cursor so I can't see how that would even be possible. Not that it helps you much. Just guessing, does anything similar happen with other actions that use custom cursors?
Nope. Only when trying to set the colliders. At least not that I've noticed. As far as moving cursors, it is possible, but I don't think you could just accidentally do it. You can see the documentation for the .NET framework in C#, C++, and VB here.
I'm pretty sure System.Windows.Forms isn't available in Mono, or at least not the version in Unity.
Hmm Okay I gotcha. I have no idea then, it's super weird. Thanks anyways!
I just purchased this product today. This is awesome. I have one issue. Please let me know if I need to adjust the sprite size. I have the Water base tile which is 128*128. The Water surface tile is 128 *99. When I place the water surface tiles on the water base, the water surface doesn't grip to the bottom of the tile. It instead stays in the middle of the tile. There is hence a gap between the water surface and base. Attached is the image. Please advise.
Thank you! Sounds like you just need to change the pivot point for the water surface tile (in the import settings for the sprite).
Is the only way to load the scene through the script? This would mean that all your other prefabs are loaded in the tile map itself. Is there a way to just view the level through the scene view and then add prefabs and make other adjustments in the scene view itself?
Scene loading is done through the script, yes. You can use the preview function in the TileEditor to show the level in the scene view.
Version 3.1 is available now:
• Using transparency in colors with SetColor/SetColorBlock works.
• Importing maps from Tiled is fixed so they aren't inverted.
• The , and . keyboard shortcut keys work correctly in certain setups that may involve more than one screen.
• Fixed making groups from a selection in the tile list so they aren't inverted.
I am using 5.6.1 version of Unity. Also using SpriteTile 3.1. I was following along with the tutorial. Everything works good. However, I follow the steps for the Sphere prefab but it doesn't place the prefab on the tile. I tried even using a coin image to create a Coin prefab. Same issue. Please could you look into this. If you want I could put my package at a drop box location so you can review.
Here is the Drop Box link -
curious to know if you've tested this system with Unity2017 beta. I just installed it in an empty project in Beta 7 and thankfully no console errors (lots of plugins don't work properly yet). Have you tried using your plugin with the new sprite atlases in Unity 2017?