Giter VIP home page Giter VIP logo

supertiled2unity's People

Contributors

beuted avatar dalqin avatar dogboydog avatar fmoo avatar ijacquez avatar jonny64bit avatar seanb-22ct avatar seanba avatar syphonx avatar vvnurmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

supertiled2unity's Issues

Super Tiled2Unity keeps freezing Unity

I just upgraded to Unity 2018.3, and at the same time upgraded from Tiled2Unity to SuperTiled2Unity.

I have a major issue though in that SuperTiled2Unity keeps freezing Unity when running the game, when exiting run mode and when opening the Levels folder in the inspector. It isn't a crash as control returns after a few minutes.

So now it takes a couple of minutes before the game will run in the edior - I click the PLAY button, it starts OK, the level music starts playing, etc, but visually just a black screen while it seems to be processing the level. A couple of minutes later it completes whatever it was doing and the level only then becomes visible and you can play.

I have over 20 TMX level files in the Levels folder - and again, if I click on that folder in Unity, it freezes for a few minutes.

Right now it is unusable like this.

The only issue I can see, although I don't know if it has any bearing, is that the TMX files have warnings stating:

"Tileset 'tilesetname' is an embedded tileset. Exported tilesets are preferred."

All the levels were created with the default 'New Tileset' option within Tiled, whereby I select a PNG tileset.

Help! :)

Custom Importer for handling Sprite Depth within a single Sorting Layer

I've been working with Tiled for about a year now and have yet to land on a reliable method for handling this issue. What I'd like to achieve is the ability for character sprites to weave in front of or behind environment sprites based on y-position of each (higher y-values behind lower y-values).

Attaching the script Overhead Sprite Sorter (included in ST2U unity package) to character sprites allows for control over each particular sprite's depth by adjusting the Order in Layer value of the attached Sprite Renderer. So this works!

depthtrackingorderinsortinglayer_a

depthtrackingorderinsortinglayer_b

However, by default Tiled imports maps with each layer having assigned a specific Sorting Layer and Order in Layer. What this means is that characters can either be in front of or behind an entire layer at once.

image_a_trees

image_a

I've since recently upgraded to ST2U and noticed that it allows for .tmx files to import tiles as individual objects. With Tiles as objects, the Overhead Sprite Sorter script can now be attached to each tile as necessary.

image_b_settings

image_c

image_b

This solves the problem aesthetically, as each environment sprite is now assigned a specific Order in Layer based on y-position, but quickly leads to an overflow of objects in Unity.

What I'd ultimately like to achieve (if it's even possible) is a Custom Import Script that renders sprites within a single Sorting Layer to have their Order in Layer assigned based on y-position in Unity.

Can this be done without forcing each tile to be an object?

Collisions not working when updated after import

Hello,

Firstly, thanks for such an awesome tool! Really appreciate all your hard work.

I seem to have hit a bit of a bug when I update the map after it has been added to my scene in Unity for the first time.

I have a collision layer in Tiled that I use to highlight all my collisions on the map. When I import it for the first time it works fine, but when I go back and update the map in Tiled with more collisions, they don't work in Unity any more.

I can see the collision polygons in Unity, so I know they're there, and they work if I remove the "Super Collider Script" component from them.

Do you have any idea why this might be?

Happy to provide more details if it would help.

Thanks again,

Matt

Bug: Animations broken if there are unused Tile ID's below the TileID of an animation

I had a tileset which had some tiles removed at one point. So instead of the tiles being 0, 1, 2, 3, etc. they started at 3, 4, 5, 6, etc. On this tileset tile 7 had an animation on it involving tiles 7, 8, 9, 10, 11 and 12.

When imported into Unity 2018.3 on the latest version of ST2U, this tileset specifically would throw an unknown error. The stacktrace led me to Line 258 of TilesetLoader.cs.

After some debugging, I realized that
xAnimation.Elements("frame").Select(f => f.GetAttributeAs("tileid"))
was returning ints of 3, 4, 5, 6 and so on.

m_TilesetScript.m_Tiles[index]
uses those ints as the index, so it gets the fourth element in the m_tiles list instead of the first one. This causes the animations used to use the wrong frames and then end up out of range at a certain point.

I fixed the issue by creating a new tileset and re-adding the images and animations to it, then re-adding the objects to the tilemap. Then it worked perfectly, because the IDs started at 0 instead of 3.

Fix stupid import warnings for VR libraries

Note to self: On first import Unity may try to import some files (related to VR? why?) that are outside the Assets directory which is producing an error.

            // Refresh dependencies for our imported object
            foreach (var assetPath in importedAssets)
            {
                if (assetPath.StartsWith("Assets", StringComparison.OrdinalIgnoreCase)) // Add this
                {
                    TiledAssetDependencies.Instance.TrackDependencies(assetPath);
                }
            }

Really huge project size after importation

Hello,
I have noticed an issue with the size of my project.
I have an average of 500 tiles sized 64*64, and an huge number of maps ( more than 300 at the end )
I test to import only a little set of map ( 12, who used lot parts of tilesets ), but after than your script import map in unity, my project folder size is over 2go ( less than 400mb before ), so i'm a bit affraid of the size if i import all of my map.
After building project, the build size stay really high.
The huge size seems to come from Library/ metadata and some files.
So, did the script when importing a map create a new map with all tiles, or only get the reference froms tilesets ?
I stay here if you need more informations.
Thanks

Improvement idea: Add option for default material for different layers

Hey Sean!

I already love the default material addition for tilemaps you made. It's really useful!

I've got to work a bit more on my project and came across an advanced version of this feature that would be really handy in my project and I can imagine others might like it as well:

It would be great if (in addition to a default material) we could define a list of layer names and a material that's assigned if a layer has a certain name in the editor.
I imagine something like a dictionary where the layer name is the key and the material the value and for every layer, the importer looks up if a key with the current layer name exists and if so, assigns the value as the material. Since (as far as I can remember) Unity doesn't by default support serialized dictionaries, a workaround that wouldn't pose too much effort could be a list of a wrapper class, that wraps the layer name and material?

Use case example:
I have reflections in my game. For the reflections to work, certain elements have to have a certain material. E.g. water needs a specific material so it reflects and distorts everything that is on a certain layer. But of course, things like grass should not reflect or distort anything at all.

With this additional feature, I could draw all the water on a "Water" layer in Tiled and then configure the import settings in such a way that the default material is assigned to all layers, except when a layer is named "Water", in which case the special water material would be assigned.

Of course this would also be possible through custom importers but this way would be much more convenient, less error prone and probably a feature there's a need for by most projects that are a bit more ambiguous.

Thanks for all your hard work and for considering my suggestion!

All the best,

Sharlatan

Sorting layouts

It there any way to sort layers as it was with custom property unity:sortingOrder?

Some questions and suggestions concerning sprite import and atlas packing

Hello there!

I have a few suggestions and questions concerning importing sprites and also about packing them into an atlas. Here we go:

  1. Would it be possible to add an option to not import sprites where every pixel is 100% transparent (alpha = 0)? I tried around a bit with discarding them but since your indexing them and use that index in various places, I can't just add a fix in one file and wouldn't want to do a bigger refactoring which I will have to try to merge again every time you publish an update of ST2U.
    Reason:
    Sometimes you realize that you don't need some sprites after all and delete them from your sprite sheet. There are good tools out there to repack your sprite sheets that would make this task easy. The only problem is, changing a sprite sheet that's used for a *.tsx file, which in turn is already used by a Tiled map, is a huge pain. Because of that, you just delete the sprites in the source picture (=make the pixels they were at transparent). Since all sprites are imported, even the ones that are 100% invisible, this leads to two problems: Firstly, the project gets cluttered with a lot of sprites that are never used. Secondly, since those transparent sprites are also packed into the atlas, This can increase the required atlas size or amount of atlases a lot, which in turn increases build size by a lot. If you have big tiles/and or small atlases, you sometimes can even end up with an atlas that only contains transparent sprites but of course uses up just as much space as if it was filled with "real" tiles.
  2. Would it be possible to expose some more atlas functions like the compression quality used? Not super important, just nice to have.
  3. Can you please explain to me how the atlas packing works? It somehow works, the results are just a bit confusing to me and I'd love to understand why things are the way they are.
    Here's an example atlas generated by ST2U:
    image
    The source tiles are 32x32 pixels and as you can see, the texture is 256x256.
    However, there are only 7 tiles per column/row but 256/32 = 8, so, theoretically 8 tiles should fit. When I make a screenshot and count the pixels, the tiles seem to be 36x36 each. This not only explain, why only 7 fit but also why there's the pink 4px border that would be the reminder of 256-7x36.
    On closer inspection, it seems like you're doubling the 2 outermost pixels of every border of the tile and adding them again as new border, at least inside the atlas. When looking at the tilemap in the scene editor or during runtime, you can't see it anymore. Is that some image sorcery to prevent seaming issues? Would you mind explaining, how this works?

Thanks a lot and have a great Sunday!

Failed to import assemably refrences. *Solved

I'm sorry to bother you about this for technicly this is not your programs falut but i'm at the end of my rope here. I've tried downloading the packae but it doesn't work because it didn't assemble or something proerly, and a solution you posted elsewhere was to open the package manager and "reset packages to default". However, niether of these are in my unity task bar. I've tried looking up a solution to this and nothing has worked. New project, folder permissions, looking for files that weren't there, diffrent versions of unity, nothing worked. I was wondering if you per chance at all knew anything that could work because i've been trying to solve this for the past few days and came up flat

How do render 16x16 tiles properly in Unity?

Here are my original Tiled Map Importer settings: imgur
Here is the result (correct): imgur

But the tiles in Tiled are actually 16x16 not 100x100

Here are the settings when I am trying to fix that imgur
Here is the result: imgur

The tiles are smaller, but it is still separating them as if the setting was still set at a PPU of 100. What am I missing?

Texture assets not importing

I may be out of my league here jumping into this but I'm unable to get the textures of my tiled map into unity. I keep getting errors on the tileset importers stating "Missing texture asset". The map loads fine in tiled and I've been able to import example maps into unity with textures intact. But specifically the maps I've tiled don't seem to work. Is there some sort of configuration issue I'm missing?

Also if there is an in depth tutorial or documentation I would be interested

Import of compressed maps crashes on Linux

On Linux, when I try to import a map that was saved in either zlib or gzip compressed base64 I get a System.DllNotFoundException. Import of uncompressed base64, csv and xml works fine.

Stack trace:

Unknown error of type System.DllNotFoundException: /home/mz/dev/Unity/2018.2.13f1/Editor/Data/Managed/../lib/libMonoPosixHelper.so
Stack Trace:
at (wrapper managed-to-native) System.IO.Compression.DeflateStreamNative.CreateZStream(System.IO.Compression.CompressionMode,bool,System.IO.Compression.DeflateStreamNative/UnmanagedReadOrWrite,intptr)
at System.IO.Compression.DeflateStreamNative.Create (System.IO.Stream compressedStream, System.IO.Compression.CompressionMode mode, System.Boolean gzip) [0x0004a] in <3acaa45225a54f778710ee6eff26f77f>:0
at System.IO.Compression.DeflateStream..ctor (System.IO.Stream compressedStream, System.IO.Compression.CompressionMode mode, System.Boolean leaveOpen, System.Boolean gzip) [0x0002d] in <3acaa45225a54f778710ee6eff26f77f>:0
at System.IO.Compression.DeflateStream..ctor (System.IO.Stream stream, System.IO.Compression.CompressionMode mode, System.Boolean leaveOpen, System.Int32 windowsBits) [0x00000] in <3acaa45225a54f778710ee6eff26f77f>:0
at (wrapper remoting-invoke-with-check) System.IO.Compression.DeflateStream..ctor(System.IO.Stream,System.IO.Compression.CompressionMode,bool,int)
at System.IO.Compression.GZipStream..ctor (System.IO.Stream stream, System.IO.Compression.CompressionMode mode, System.Boolean leaveOpen) [0x00006] in <3acaa45225a54f778710ee6eff26f77f>:0
at System.IO.Compression.GZipStream..ctor (System.IO.Stream stream, System.IO.Compression.CompressionMode mode) [0x00000] in <3acaa45225a54f778710ee6eff26f77f>:0
at (wrapper remoting-invoke-with-check) System.IO.Compression.GZipStream..ctor(System.IO.Stream,System.IO.Compression.CompressionMode)
at SuperTiled2Unity.Editor.ByteExtensions.GzipDecompress (System.Byte[] bytesCompressed) [0x00010] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Extensions/ByteExtensions.cs:28
at SuperTiled2Unity.Editor.TmxAssetImporter.ReadTileIds_Base64 (System.Xml.Linq.XElement xElement, SuperTiled2Unity.Editor.DataCompression compression, System.Collections.Generic.List`1[System.UInt32]& tileIds) [0x00036] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.TileLayer.cs:347
at SuperTiled2Unity.Editor.TmxAssetImporter.ReadTileIdsFromChunk (SuperTiled2Unity.Editor.TmxAssetImporter+Chunk chunk) [0x0007a] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.TileLayer.cs:162
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessLayerDataChunk (UnityEngine.GameObject goTilemap, SuperTiled2Unity.Editor.TmxAssetImporter+Chunk chunk) [0x0001b] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.TileLayer.cs:141
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessLayerData (UnityEngine.GameObject goLayer, System.Xml.Linq.XElement xData) [0x00322] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.TileLayer.cs:132
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessTileLayer (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xLayer) [0x00068] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.TileLayer.cs:46
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMapLayers (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xMap) [0x00050] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.cs:223
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMap (System.Xml.Linq.XElement xMap) [0x000a3] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.cs:81
at SuperTiled2Unity.Editor.TmxAssetImporter.InternalOnImportAsset () [0x00033] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.cs:53
at SuperTiled2Unity.Editor.SuperImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) [0x00048] in /home/mz/dev/panklings/unity-panklings/Assets/SuperTiled2Unity/Scripts/Editor/Importers/SuperImporter.cs:52
UnityEngine.Debug:LogErrorFormat(String, Object[])
SuperTiled2Unity.Editor.SuperImporter:OnImportAsset(AssetImportContext) (at Assets/SuperTiled2Unity/Scripts/Editor/Importers/SuperImporter.cs:72)
UnityEditor.Experimental.AssetImporters.ScriptedImporter:GenerateAssetData(AssetImportContext)**

Z scale is set to 0 on rotated/flipped tiles

If I place a tile in Tiled and but flip it on the X axis, Tiled2Unity sets the Z scale to 0 for some reason. It changes the X scale to -1 as it should to show it flipped on the X axis, but for some reason the Z is also changed. It doesn't do this on normal tiles.

Two things I changed recently

  • Changed the Default Material in the settings
  • Updated to 1.1.6.

screen shot 2018-12-28 at 10 23 11 pm

Tiles with Z of 0 are black.
screen shot 2018-12-28 at 10 26 03 pm

Feature request: Add option to not import sprites where every pixel is 100% transparent

As discussed in #36 :

Would it be possible to add an option to not import sprites where every pixel is 100% transparent (alpha = 0)?
I tried around a bit with discarding them but since your indexing them and use that index in various places, I can't just add a fix in one file and wouldn't want to do a bigger refactoring which I will have to try to merge again every time you publish an update of ST2U.

Reason:
Sometimes you realize that you don't need some sprites after all and delete them from your sprite sheet. There are good tools out there to repack your sprite sheets that would make this task easy. The only problem is, changing a sprite sheet that's used for a *.tsx file, which in turn is already used by a Tiled map, is a huge pain. Because of that, you just delete the sprites in the source picture (=make the pixels they were at transparent). Since all sprites are imported, even the ones that are 100% invisible, this leads to two problems: Firstly, the project gets cluttered with a lot of sprites that are never used. Secondly, since those transparent sprites are also packed into the atlas, This can increase the required atlas size or amount of atlases a lot, which in turn increases build size by a lot. If you have big tiles/and or small atlases, you sometimes can even end up with an atlas that only contains transparent sprites but of course uses up just as much space as if it was filled with "real" tiles.

Texture was imported at a smaller size. Make sure "Max Size" is at least 2516

Where 2516 seems to be the width of the image asset that it's trying to import. I'm getting this on multiple tilemaps and images. After that error message it reads "Could not find Tile X. Make sure the tilesets were successfully imported" for every tile ID that is used in the map.

I was able to fix it on one map by moving around tiles to a different width but I'm not sure how that fixed anything, and the tileset widths range from 48px to 2516px on different TMX maps, could you shed some light on how to avoid this error message?

Bug/Problem: When importing an isometric tiled map, the tiles are overlapping each other in the wrong way.

When I import an isometric Tiled map into Unity, the tiles are overlapping each other:
image
While it should actually look like this:
image
I tried messing around with some configs and changing the Layer/Object Sorting from "Stacking" to "Overhead Dynamic" changed it on the scene, but it messed with my tiles layers when I hit play and test the game.
Inside the Scene:
image
When I hit play and go to game mode:
image
As its possible to see, the plants and the road, wich are in other layers, have been overlapped.

Set ColliderType on imported tiles?

It'd be useful to have a default way to set the Unity Tile.ColliderType property, so tilemap colliders can be generated properly.

I assume the reason you don't have this already is because Tiled doesn't really (so far as I could tell) have a flag for this. In my case I just added a custom "solid" property, and then added the code below to SuperTile.GetTileData()

var solid = new CustomProperty();
CustomPropertyExtensions.TryGetProperty(m_CustomProperties, "solid", out solid);
tileData.colliderType = solid.GetValueAsBool() ? Tile.ColliderType.Grid : Tile.ColliderType.None;

If there's a proper way of doing this, let me know, but otherwise this is just to document a way to work around for anyone with the same issue. ๐Ÿ‘

Tile properties

The importer supports map properties (defined for a tilemap as a whole), but does the importer support tile properties?

These are vitally important - if anyone is going to use Tiled to place gameplay-specific stuff (like event triggers, spawn points, and so forth) it'll probably be done using tiles with individual tile properties. I mean the ones you get when editing the tileset and clicking on a tile:

image

Custom importers not working (methd TmxAssetImported not called upon import)

Hi

I tried to write some custom importers but they were never called. I thought maybe I did something wrong and then uncommented the examples in https://github.com/Seanba/SuperTiled2Unity/blob/master/SuperTiled2Unity/Assets/SuperTiled2Unity/Scripts/Editor/CustomImporters/CustomTmxImporter.cs but they don't work neither.

I could track the problem as far as to this file: https://github.com/Seanba/SuperTiled2Unity/blob/master/SuperTiled2Unity/Assets/SuperTiled2Unity/Scripts/Editor/Importers/TmxAssetImporter.cs

The following line in method private void DoCustomImporting always evauluates to false (m_CustomImporterClassName always an empty string):

if (!string.IsNullOrEmpty(m_CustomImporterClassName))

I couldn't find any calls in the code that would set m_CustomImporterClassName and I'm not really sure where that should happen. The system seems to be a bit different from old Tiled2Unity, where we had to use a custom importer attribute and all custom importers were then fetched via

// Find all the types with the CustomTiledImporterAttribute, instantiate them, and give them a chance to customize our prefab
var types = from a in AppDomain.CurrentDomain.GetAssemblies()
            from t in a.GetTypes()
            where typeof(ICustomTiledImporter).IsAssignableFrom(t)
            where !t.IsAbstract
            from attr in System.Attribute.GetCustomAttributes(t, typeof(CustomTiledImporterAttribute))
            let custom = attr as CustomTiledImporterAttribute
            orderby custom.Order
            select t;

var instances = types.Select(t => (ICustomTiledImporter)Activator.CreateInstance(t));
return instances.ToList();

so, I'm unfortunately not really sure where to start debugging this.

I really like the idea of making use of Unity's tile maps and am trying to port my project from Tiled2Unity to SuperTiled2Unity but I really need the custom importers for that.

Thank you very much for your support!

Errors Loading Unity Package

supertiled2unityerrors

I'm attempting to install the unity package into a blank project and I keep running into this list of errors.

My project is completely empty other than the Super Tiled2Unity packcage.

Texture Rectangle is out of bounds

I've created a map and tileset in Tiled using 240x240 pixel tiles.
When I import that into Unity using "Super Tiled2Unity", I get loads of "Texture Rectangle is out of bounds" errors.

I tried this will a map and tileset that I created using 16x16 pixel tiles and it worked absolutely fine.

Is there a problem with using ST2U with larger pixel images? I've tried this maybe 20 times now and every time I get the same error. I've tried starting a fresh Unity project and freshly installing "Super Tiled2Unity" but still I'm getting the same issue.

Please help!

Isometric tilelayer doesn't match imagelayer

I am doing some test by using SuperTiled2Unity, and I found in isometric mode, the image layers doesn't match the tile layer, their releative offset was wrong.
In Tiled map editor:
image
In Unity:
image
I have to adjust the tile layer position_x by adding an offset which is SuperMap.m_Height * SuperMap.m_TileHeight to match the image layer.
Object layer has the same problem with the tile layer.

Patreon consideration?

I don't know how hard it is to setup a Patreon, but I use it a lot to support content creators that I am benefiting from. thoughts?

Errors after importing.

Hi! So here are my problems: i've done my maps on tiled, nothing too complicated, and i decide to import it into unity using ST2U, that i already used someday. So i click on Assets>Import New Assets; select the map, the tileset and the tileset's image, import them, but then, error messages on the screenshots. What should i do?
erreur1 (error on the map's inspector)
erreur2 (error on the tileset's inspector)
Thank you, Don Thomas.

Bug/Problem: When instantiating prefabs in custom importer and attaching them to the imported map, all children get sorted alphabetically

Ok, this might be a bit hard to explain, but let me try my best:

When you have a custom importer and instantiate a prefab in that importer, then attach the prefab to the map or a child of the map, like a layer (really doesn't matter on which hierarchy level), all the prefab's children get alphabetically.

I described why this is a problem for UI prefabs here, where I wasn't thinking too clearly and first thought, it might be a Unity bug, without debugging thins better before posting: https://forum.unity.com/threads/solved-prefab-instantiation-bug-in-2018-3-maybe-sooner-children-get-sorted-alphabetically.601429/#post-4022794

To replicate, I made a small demo project you can get here: https://drive.google.com/open?id=13bbs0CUfcYeZx20OU8vNMHMYm4Opcd6F

I'm using Unity 2018.3.0f2, btw.

In this project you can find the following things.:

  • The prefab TestPrefab: Prefab that contains a canvas with two panels, a back panel and a front panel. In the prefab, the front panel comes after the back panel hierarchically, thus obstructing the back panel. However, the panels are named in such a way that the back panel will obstruct the front panel, when sorted alphabetically.
  • The custom PrefabInstantiationImporter-importer. This importer creates an instance of TestPrefab and adds it to the map.
  • The scene SampleScene, which is used to demonstrate the problem

SampleScene contains the following noteworthy elements:

  • A TestOvehad map prefab. The map also already has set the custom importer. As you can see in the children of the TestPrefab(Clone)-object, which itself is now a child of the map prefab, all the children are sorted alphabetically. This will stay the same, when you reimport the map.
    As you can see when running the scene, the back panel is now obstructing the front panel.
  • A disabled GameObject named "PrefabInstantiator". When you enable this object and start the scene, the object has a script attached that will make an instance of TestPrefab and add it to the scene. If you look at that instance, you'll notice that the children of the prefab weren't reordered alphabetically, which is the desired behavior.

Feel free to ask if you have any questions!

Thanks a lot for your support and have a nice weekend!

Is there a roadmap for the future of this tool?

I am really interested in this tool! It looks slick and the demo project you have shows off some really powerful integration. I have two questions for you:

  1. Do you have plans for the immediate future of this tool?
  2. Is this tool intended to fully replace the old one eventually? I don't mind the extra step to import the tiles if it means I get more overall features. I just want a tool that can give me the most power and control over how much of my level design gets to (efficiently) live inside Tiled.

Doesn't contain a definition.

Assets/SuperTiled2Unity/Scripts/Editor/ThirdParty/dotnetzip-for-unity/BZip2/ParallelBZip2OutputStream.cs(322,61): error CS0117: Environment' does not contain a definition for ProcessorCount'

Tiled Type not importing

  • Open a Tileset in Tiled
  • Then select a single tile
  • Then enter a value in the properties area
  • Open Unity
  • m_Type is blank

Using Super Custom Properties works fine.

Feature request: More options for sprite atlas generation

As discussed in #36 :

It would be nice to have some more options for generating the sprite atlases. Since currently a custom atlas system is used, I'm not sure what all the options that could be exposed are. But I was thinking about things like e.g. a compression quality setting.

Importing process is too slow.

I want to import a big map into Unity.
Size of map is 256x512 (isometric staggered). It has 16384 x 8192 pixels. I split it to 64 tile sets, and each tile set has 1024 tiles, 64x32 pixels for each tile.
It takes me nearly 2 hours to waiting importing process. It's too slow!!!
image
It takes much time and use much CPU time in generating metadata of .tsx files.
Besides, after map imported, any operations about the .tsx file will make Unity die for 20 seconds, include open folder with .tsx
Other Information:
Unity Version: 2018.3.6f1
Super Tile2Unity version: 1.2.4
Tiled Editor Version: 1.2.2
Operation System: Windows 10 10.0.17134
CPU: Intel Core i7 6700HQ

Large image as image background produces error

I have a pretty large (6472 x 3641) picture set as my image background in my level. When trying to import it with the map, I receive the following:

Unknown error of type System.ArgumentException: Could not create sprite (0, 0, 6472, 3641) from a 2048x1152 texture.
Stack Trace:
at UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude, UnityEngine.SpriteMeshType meshType, UnityEngine.Vector4 border, System.Boolean generateFallbackPhysicsShape) [0x000a2] in C:\buildslave\unity\build\Runtime\2D\Common\ScriptBindings\Sprites.bindings.cs:269
at UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude, UnityEngine.SpriteMeshType meshType, UnityEngine.Vector4 border) [0x0000c] in C:\buildslave\unity\build\Runtime\2D\Common\ScriptBindings\Sprites.bindings.cs:280
at UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude, UnityEngine.SpriteMeshType meshType) [0x0000e] in C:\buildslave\unity\build\Runtime\2D\Common\ScriptBindings\Sprites.bindings.cs:285
at UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude) [0x00008] in C:\buildslave\unity\build\Runtime\2D\Common\ScriptBindings\Sprites.bindings.cs:290
at UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit) [0x00006] in C:\buildslave\unity\build\Runtime\2D\Common\ScriptBindings\Sprites.bindings.cs:295
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessImageLayer (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xLayer) [0x000f8] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.ImageLayer.cs:43
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMapLayers (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xMap) [0x000ce] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:235
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMap (System.Xml.Linq.XElement xMap) [0x000a3] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:82
at SuperTiled2Unity.Editor.TmxAssetImporter.InternalOnImportAsset () [0x00033] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:54
at SuperTiled2Unity.Editor.SuperImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) [0x00048] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\SuperImporter.cs:52
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:LogFormat(LogType, String, Object[])
UnityEngine.Debug:LogErrorFormat(String, Object[])
SuperTiled2Unity.Editor.SuperImporter:OnImportAsset(AssetImportContext) (at Assets\SuperTiled2Unity\Scripts\Editor\Importers\SuperImporter.cs:72)
UnityEditor.Experimental.AssetImporters.ScriptedImporter:GenerateAssetData(AssetImportContext) (at C:\buildslave\unity\build\Editor\Mono\AssetPipeline\ScriptedImporter.cs:19)

Importing without it and then just putting it in a scene separately, works fine, therefore it seems like Unity can take it (and is not the one that throws the error?).

Dependency Not Recognized on Import

Hello,

I'm attempting to import my first map with Tiled 1.2 and supertiled2unity. I tried a bunch of things, but in the end, I've ended up with my png (raw image), my tsx (single tileset), and my tmx in one TileMaps folder in my project. The importer is catching them fine, and has correctly identified the dependency between the png and tsx. However, it hasn't identified the dependency between the tmx and the tsx, and will not display. I get the following error:

Missing tileset asset: Assets/TileMaps/TestMap1.tmx

I have:
-reimported the tmx, both manually and through the ST2U settings
-saved and restarted Unity, also reimporting
-double checked the source file to make sure everything is hooked up to the correct map, I'm working with very few files as this is just a test

If you could let me know if I'm doing something out of order, or if I need to add the dependency myself via script, I'd be very grateful. I've been following Tiled and Tiled2Unity for several years, and I'm very thankful for your hard work.

Arkrusti

Lost many data components on instance of map prefab

Original Post: Rotated tiles in Tiled are not rotated correctly in Unity
If I use the rotate left/right or flip buttons on a tile in Tiled, then when imported into Unity it's not rotated at all. I'm not sure if this is always the case.

Test Runner Assembly: Could not found namespace for dotnetzip

I use Unity Test Runner to do unit test for my game; however when I created Assembly Definition for game scripts (inlcuded SuperTiled2Unity), it would log some System and Microsoft namespace could not be found for dotnetzip for Unity.

Assets\Scripts\SuperTiled2Unity\Scripts\Editor\ThirdParty\dotnetzip-for-unity\Zip\Shared.cs(616,33): error CS0246: The type or namespace name 'SecurityPermission' could not be found (are you missing a using directive or an assembly reference?)
Assets\Scripts\SuperTiled2Unity\Scripts\Editor\ThirdParty\dotnetzip-for-unity\Zip\ZipFile.SaveSelfExtractor.cs(760,58): error CS1069: The type name 'CSharpCodeProvider' could not be found in the namespace 'Microsoft.CSharp'. This type has been forwarded to assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.
Assets\Scripts\SuperTiled2Unity\Scripts\Editor\ThirdParty\dotnetzip-for-unity\Zip\ZipFile.SaveSelfExtractor.cs(790,58): error CS1069: The type name 'CompilerParameters' could not be found in the namespace 'System.CodeDom.Compiler'. This type has been forwarded to assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.
Assets\Scripts\SuperTiled2Unity\Scripts\Editor\ThirdParty\dotnetzip-for-unity\Zip\ZipFile.SaveSelfExtractor.cs(1015,62): error CS1069: The type name 'CompilerError' could not be found in the namespace 'System.CodeDom.Compiler'. This type has been forwarded to assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.

Input string in incorrect format - Import error

Hey, it's me again.

As suggested from the issue in Tiled2Unity, I upped my Unity version (currently using 2018.2.10f1), to try out SuperTiled2Unity but when trying to import I keep getting the same error at the map file -

Unknown error of type System.FormatException: Input string was not in a correct format.

Stack Trace:
at System.Number.ParseSingle (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) [0x00083] in :0
at System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00000] in :0
at System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.IFormatProvider provider) [0x0000e] in :0
at System.Convert.ToSingle (System.String value, System.IFormatProvider provider) [0x00009] in :0
at System.String.System.IConvertible.ToSingle (System.IFormatProvider provider) [0x00000] in :0
at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x0018e] in :0
at System.Convert.ChangeType (System.Object value, System.Type conversionType) [0x0000c] in :0
at SuperTiled2Unity.Editor.XmlExtensions.GetAttributeAs[T] (System.Xml.Linq.XElement element, System.String name, T defaultValue) [0x000d5] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Extensions\XmlExtensions.cs:107
at SuperTiled2Unity.Editor.SuperLayerLoader.CreateLayer (UnityEngine.GameObject go) [0x0004c] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Loaders\SuperLayerLoader.cs:26
at SuperTiled2Unity.Editor.GameObjectExtensions.AddSuperLayerGameObject[T] (UnityEngine.GameObject goParent, SuperTiled2Unity.Editor.SuperLayerLoader loader, SuperTiled2Unity.Editor.SuperImportContext importContext) [0x00009] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Extensions\GameObjectExtensions.cs:39
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessImageLayer (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xLayer) [0x0001a] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.ImageLayer.cs:19
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMapLayers (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xMap) [0x000ce] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:235
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessGroupLayer (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xGroup) [0x00044] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.GroupLayer.cs:20
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMapLayers (UnityEngine.GameObject goParent, System.Xml.Linq.XElement xMap) [0x0007a] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:227
at SuperTiled2Unity.Editor.TmxAssetImporter.ProcessMap (System.Xml.Linq.XElement xMap) [0x000a3] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:82
at SuperTiled2Unity.Editor.TmxAssetImporter.InternalOnImportAsset () [0x00033] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\TmxAssetImporter.cs:54
at SuperTiled2Unity.Editor.SuperImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) [0x00048] in D:\UnityProjects\ThePenIsMightierThanTheSword\Assets\SuperTiled2Unity\Scripts\Editor\Importers\SuperImporter.cs:52
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:LogFormat(LogType, String, Object[])
UnityEngine.Debug:LogErrorFormat(String, Object[])
SuperTiled2Unity.Editor.SuperImporter:OnImportAsset(AssetImportContext) (at Assets\SuperTiled2Unity\Scripts\Editor\Importers\SuperImporter.cs:72)
UnityEditor.Experimental.AssetImporters.ScriptedImporter:GenerateAssetData(AssetImportContext) (at C:\buildslave\unity\build\Editor\Mono\AssetPipeline\ScriptedImporter.cs:19)

I've made sure to attach all correct files, and Unity is not complaining about any missing dependencies either at the map, or the tile sets.

Any suggestions?

Improvement idea: Add default Tilemap rendere material to ST2U Settings

Exemplary use case:

I'm using a directional light that changes it's color over time as "sun". However, the Sprites-Default material, that gets added to all the Tilemap Render components is not influenced by light sources. That's why I need to assign my own material.

I do this by writing a custom importer which looks something like this:

public class ExampleImporter : CustomTmxImporter
{

  public override void TmxAssetImported(TmxAssetImportedArgs args)
  {
    ReplaceSpriteDefaultMaterialWithDiffuseDepthInstanced(map);
  }

  private static void ReplaceSpriteDefaultMaterialWithDiffuseDepthInstanced(SuperMap map)
  {
    var spriteRenderers = map.GetComponentsInChildren<TilemapRenderer>();

    //path fetching a little simplified so the example stays easy to understand
    var materialPath = Path.Combine("Assets\\Main\Resources\\SuperTiled2Unity\\Materials\\StandardTilemapRendererMaterial.mat", "StandardTilemapRendererMaterial.mat");
    var material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);

    foreach (var spriteRenderer in spriteRenderers)
    {
      spriteRenderer.material = material;
    }
  }
}

Granted, this works but it would be way more convenient if one would be able to set a default material in ST2U Settings that then would be applied to all Tilemap Renderer components upon import.
Especially, I could then move the material freely around in the hierarchy, rename it, etc.. As things stand now, the path is hard coded and whenever I move the material around or rename it, I will have to remember to update my code.

In my actual code I, at least have one file where I get all the paths from and it would probably be doable to just use the name and search all the assets or whatever. But it would be so much easier if we could just drag and drop the default material in the settings.

Thanks a lot for your consideration!

Animations having severely reduced speeds when in Unity

At this point it feels like I should apologize for posting yet again.

I have a bunch of animated Tiles for various objects/effects but the easiest to see example would be the water animation.
The transition between tile states is set to 100 (the default) in Tiled.

This is how it appears in TIled (ignore any jitters at the bottom):
intiledsmall

This is how it appears in Unity (again, ignore any jitters at the bottom):
inunitysmall

Link back to the itch.io page in the readme

This repo might be the only thing passed around for the more dev-heavy users of your library. It might be worth it for you to link back to the itch.io page at the bottom so people know there is an easy way to support the project.

Map sorts above Sprite in rendering

When I import a map into my scene, all is well. But, when I put my sprite over the map, it disappears. I ended up fixing it by changing their order in the sorting layer, but I'm not sure what could be causing this.

How to automatically create prefabs from Tiled objects?

I can't find anything that touches on creating prefabs from the Tiled maps. If I had a Spikes unity prefab, how would I place spikes in Tiled, import it to Unity, and get my Spikes prefab to be automatically created from that tile?

Reimport tiled assets error

Hey, encountered this bug today after downloading 1.1.4

EndLayoutGroup: BeginLayoutGroup must be called first.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Steps to reproduce:

  1. Import SuperTiled2Unity unitypackage
  2. Import any .tmx asset
  3. Click Reimport Tiled Assets in ST2U settings asset

Didn't get any other error messages or any other error details

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.