Seanba / SuperTiled2Unity

Imports Tiled files to Unity. Better than regular Tiled2Unity.
MIT License
669 stars 84 forks source link

Failed to import tmx: unknown error under macOS (Apple Silicon) #273

Closed PythonLimited closed 3 months ago

PythonLimited commented 5 months ago

Hi, I recently wanted to try out supertiled2unity on my Macbook Pro (M3Pro - latest os update). However every time I drag the supertiled2unity folder into my unity project, it loads some scripts and compiles something in the background, but then spits out a bunch of errors in the log. I am also unable to load any of the sample tmx files included in the project.

I tried this on a windows machine and I don't have any problems there.

What I noticed from the logs is that it formats them, and looking at the source, it is maybe an issue with how macOS handles file paths? Also it just plain fails to recognize that the path that's about to be sanitized, already includes my home directory, thus prefixing it anyway. I did try some stuff out so that the file paths would be correct (upper-case and correctly sanitized), but then I would still get errors about missing files in the editor.

Below is the console output of just loading the supertiled2unity project, as well as two screenshots of the error messages in the inspector.

`Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/testoverhead.tmx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/testoverhead.tmx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:240) SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21) SuperTiled2Unity.Editor.SuperTexturePostprocessor:AddSpritesFromTiledFiles () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:68) SuperTiled2Unity.Editor.SuperTexturePostprocessor:OnPreprocessTexture () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:42) UnityEditor.AssetPostprocessingInternal:PreprocessTexture (string,UnityEditor.AssetImporters.AssetImportContext) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:839)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/overhead-objects.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/overhead-objects.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:247) SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21) SuperTiled2Unity.Editor.SuperTexturePostprocessor:AddSpritesFromTiledFiles () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:68) SuperTiled2Unity.Editor.SuperTexturePostprocessor:OnPreprocessTexture () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:42) UnityEditor.AssetPostprocessingInternal:PreprocessTexture (string,UnityEditor.AssetImporters.AssetImportContext) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:839)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/scraps.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/scraps.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:247) SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21) SuperTiled2Unity.Editor.SuperTexturePostprocessor:AddSpritesFromTiledFiles () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:68) SuperTiled2Unity.Editor.SuperTexturePostprocessor:OnPreprocessTexture () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:42) UnityEditor.AssetPostprocessingInternal:PreprocessTexture (string,UnityEditor.AssetImporters.AssetImportContext) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:839)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/tiles.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/tiles.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:247) SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21) SuperTiled2Unity.Editor.SuperTexturePostprocessor:AddSpritesFromTiledFiles () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:68) SuperTiled2Unity.Editor.SuperTexturePostprocessor:OnPreprocessTexture () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:42) UnityEditor.AssetPostprocessingInternal:PreprocessTexture (string,UnityEditor.AssetImporters.AssetImportContext) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:839)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/water.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/water.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:247) SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21) SuperTiled2Unity.Editor.SuperTexturePostprocessor:AddSpritesFromTiledFiles () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:68) SuperTiled2Unity.Editor.SuperTexturePostprocessor:OnPreprocessTexture () (at Assets/super-tiled2unity.v2.2.0/Editor/Postprocessors/SuperTexturePostprocessor.cs:42) UnityEditor.AssetPostprocessingInternal:PreprocessTexture (string,UnityEditor.AssetImporters.AssetImportContext) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:839)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/overhead-objects.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/overhead-objects.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:198) SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:313) UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/scraps.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/scraps.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:198) SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:313) UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/tiles.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/tiles.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:198) SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:313) UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/water.tsx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/zoria tileset/water.tsx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:198) SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:313) UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/testoverhead.tmx': Could not find a part of the path "/Users/mcsbuild/Test/users/mcsbuild/test/assets/super-tiled2unity.v2.2.0/samples/overhead/maps/testoverhead.tmx". UnityEngine.Debug:Log (object) SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65) SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:198) SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:313) UnityEditor.AssetPostprocessingInternal:PostprocessAl lAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

`

Screenshot 2024-06-17 at 3 22 55 PM Screenshot 2024-06-17 at 3 23 07 PM
PythonLimited commented 5 months ago

I now also tried it with the intel unity flavor - however with the same result.

PythonLimited commented 5 months ago

Ok I just got it semi-working. Simple tile sets (like the one you include) do work, but anything more complex doesn't. The main issue from what I found is that by sanitizing the path and removing the '/' at the beginning of the path, the check if path.StartsWith(Application.dataPath does not return true anymore -> therefore signaling to supertiled2unity that an import error has occurred. Once I removed that it imported the actual assets fine, but when I wanted to import a sample assetpack it now still complained about missing assets. By using the button "Add sprites..." it does work, but I'd now have to do that for every file which is annoying.

But perhaps you can give some insight why this is happening in the first place, as on Linux this should happen too (if dotnet returns the string starting at home for directory listings idk)

PythonLimited commented 5 months ago
Screenshot 2024-06-17 at 5 29 31 PM
seanb-22ct commented 5 months ago

Hi there, @PythonLimited. It looks like you put the ST2U package into your Assets folder but it is meant to be imported into your project through the Unity Package Manager. Can you unzip the ST2U file and put that folder into your Packages directory and let me know if that fixes things up for you?

Put another way, you have ST2U here: YourGame/Assets/super-tiled2unity.v2.2.0 But it should go here: YourGame/Packages/super-tiled2unity.v2.2.0

PythonLimited commented 5 months ago

Hi there, @PythonLimited. It looks like you put the ST2U package into your Assets folder but it is meant to be imported into your project through the Unity Package Manager. Can you unzip the ST2U file and put that folder into your Packages directory and let me know if that fixes things up for you?

Put another way, you have ST2U here: YourGame/Assets/super-tiled2unity.v2.2.0 But it should go here: YourGame/Packages/super-tiled2unity.v2.2.0

Oh, my bad. It worked just fine that way on my windows based machine, but I'll try that out ASAP. Thanks!

PythonLimited commented 5 months ago

Hi there, @PythonLimited. It looks like you put the ST2U package into your Assets folder but it is meant to be imported into your project through the Unity Package Manager. Can you unzip the ST2U file and put that folder into your Packages directory and let me know if that fixes things up for you?

Put another way, you have ST2U here: YourGame/Assets/super-tiled2unity.v2.2.0 But it should go here: YourGame/Packages/super-tiled2unity.v2.2.0

alright, I put a fresh version in the packages folder now, however I'm getting the same error messages as in the beginning with the only exception being the path now (./packages instead of assets/supertiled3unity) I then tried the one with my edits and it loads the simple example, but not more complex assetpacks.

Anyhow here are the logs (I put in some warnings in too that I skipped before since there are like 1k+ of them in the log):

UnityEditor.AssetDatabase:ImportAsset (string)
SuperTiled2Unity.Editor.SpriteRectsManager:CheckForTextureReimports (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:189)
SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:205)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:311)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool)

Importer(TextureImporter) generated inconsistent result for asset(guid:34abc9825896e4c2e8c1c14d2afd6761) "Assets/art/erw-ar/Tilesets/Transparency version/wall-2 - 3 tiles tall.png"
UnityEditor.AssetDatabase:ImportAsset (string)
SuperTiled2Unity.Editor.SpriteRectsManager:CheckForTextureReimports (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:189)
SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:205)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:311)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool)

Importer(TextureImporter) generated inconsistent result for asset(guid:e547a8d773e57419f9462ea248d89122) "Assets/art/erw-ar/Props/Atlas-Props.png"
UnityEditor.AssetDatabase:ImportAsset (string)
SuperTiled2Unity.Editor.SpriteRectsManager:CheckForTextureReimports (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:189)
SuperTiled2Unity.Editor.SpriteRectsManager:ImportTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:205)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:311)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/ancient ruins example map.tmx': Could not find a part of the path "/Users/mcsbuild/My project/users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/ancient ruins example map.tmx".
UnityEngine.Debug:Log (object)
SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65)
SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:240)
SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:330)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/sample scene.tmx': Could not find a part of the path "/Users/mcsbuild/My project/users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/sample scene.tmx".
UnityEngine.Debug:Log (object)
SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65)
SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:240)
SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:330)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/rules/wall-1-rule0-erases all generated tiles and resets them to their initial state.tmx': Could not find a part of the path "/Users/mcsbuild/My project/users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/rules/wall-1-rule0-erases all generated tiles and resets them to their initial state.tmx".
UnityEngine.Debug:Log (object)
SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65)
SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:240)
SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:330)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)

Looking for tilesets. Unknown error processing Tiled file 'users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/rules/wall-1-rule1-places all tiles.tmx': Could not find a part of the path "/Users/mcsbuild/My project/users/mcsbuild/my project/users/mcsbuild/my project/assets/art/erw-ar/tiledmap editor/rules/wall-1-rule1-places all tiles.tmx".
UnityEngine.Debug:Log (object)
SuperTiled2Unity.Editor.SpriteRectsManager:ProcessTiledFile (string) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:65)
SuperTiled2Unity.Editor.SpriteRectsManager:CreateInstance () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:240)
SuperTiled2Unity.Editor.SpriteRectsManager:.cctor () (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:21)
SuperTiled2Unity.Editor.SpriteRectsManager/InternalAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Packages/super-tiled2unity.v2.2.0/Editor/Sprite/SpriteRectsManager.cs:330)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)
seanb-22ct commented 5 months ago

Thanks for trying, @PythonLimited. I'll try to get my hands on a Mac so I can figure this out.

mminer commented 5 months ago

I also ran into this problem on macOS. StringExtensions.SanitizePath looks to be the culprit — it strips the leading / from path names, so in places like this: https://github.com/Seanba/SuperTiled2Unity/blob/3eb57d1c1588c1f667a76eee68f737921d29cf08/SuperTiled2Unity/Packages/com.seanba.super-tiled2unity/Editor/Sprite/SpriteRectsManager.cs#L38-L46

It passes what looks like a relative path, e.g. users/mminer/project/assets/tileset.tsx.

A quick fix is to remove this line: https://github.com/Seanba/SuperTiled2Unity/blob/3eb57d1c1588c1f667a76eee68f737921d29cf08/SuperTiled2Unity/Packages/com.seanba.super-tiled2unity/Editor/Extensions/StringExtensions.cs#L50-L51

Though I assume the logic to remove repeated slashes and the slash at the end has a good reason to be there.

Seanba commented 5 months ago

Hi there, @mminer. Thanks for pointing that out. That has led me to what I think the fix needs to be. Unfortunately my plans to obtain to a MacBook for proper testing hasn't worked out but I'll find time to address this soon.

Seanba commented 5 months ago

Hi there, @PythonLimited and @mminer. Can you try version 2.2.1 and see if that fixes you up? Unfortunately I had to fix this without testing on proper Mac (or Linux) hardware but I think I addressed the problem.

Zip is here: super-tiled2unity.v2.2.1.zip

mminer commented 4 months ago

v2.2.1 works great for me. Thanks for the fix!

PythonLimited commented 4 months ago

Hi there, @PythonLimited and @mminer. Can you try version 2.2.1 and see if that fixes you up? Unfortunately I had to fix this without testing on proper Mac (or Linux) hardware but I think I addressed the problem.

Zip is here: super-tiled2unity.v2.2.1.zip

tried it out on my windows machine by accident - and im getting the same error weirdly enough - lots of weird purple madness on the maps... image

this leads me to believe its an error with the tileset or so? i can invite you to a repo with the tileset so you can have a look if you want - maybe its just something stupid from the tileset creator?

PythonLimited commented 4 months ago

btw when click on these "Add Sprites to " buttons the map then displays correctly: image

seanb-22ct commented 4 months ago

Hi there, @PythonLimited. An invitation to your repo is fine. What I think is happening is indicated by the warning in your Console window. Your texture needs to be cut up into 2340 sprites which bogs Unity down. I currently have it limited so that only 2048 sprites are created per import, otherwise your import time could take hours.

(Sorry, that's a Unity thing. They have an O(n^2) algorithm in their code that splits up textures into sprites.)

However, if you hit the "Add Sprites" button then up to another 2048 sprites are added to your texture (if that makes sense). So, there is a way to move past this, which you seem to have figured out.

If possible it would be best to use textures with a smaller number of tiles/sprites in it. And like I said before I'm happy to look at your repo.

PythonLimited commented 3 months ago

Hi there, @PythonLimited. An invitation to your repo is fine. What I think is happening is indicated by the warning in your Console window. Your texture needs to be cut up into 2340 sprites which bogs Unity down. I currently have it limited so that only 2048 sprites are created per import, otherwise your import time could take hours.

(Sorry, that's a Unity thing. They have an O(n^2) algorithm in their code that splits up textures into sprites.)

However, if you hit the "Add Sprites" button then up to another 2048 sprites are added to your texture (if that makes sense). So, there is a way to move past this, which you seem to have figured out.

If possible it would be best to use textures with a smaller number of tiles/sprites in it. And like I said before I'm happy to look at your repo.

sorry for the late reply, but yes upping the number indeed worked. thanks!