Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing the sample Overhead from super-tiled2unity.v2.1.0 using Unity2022.3.9 will catch the exceptions. #253

Open
streamcypher opened this issue Sep 14, 2023 · 10 comments

Comments

@streamcypher
Copy link

SuperTiled2Unity version: unknown, Unity version: 2022.3.9f1

Unknown error encountered. Please report as bug. Stack track is in the console output.

Object reference not set to an instance of an object

Unknown error of type importing 'Assets/ThirdParty/super-tiled2unity/Samples/Overhead/Maps/Zoria Tileset/scraps.tsx': Failed to add object of type SuperTile. Check that the definition is in a file of the same name and that it compiles properly.

Stack Trace:

at (wrapper managed-to-native) UnityEditor.AssetImporters.AssetImportContext.AddObjectToAsset(UnityEditor.AssetImporters.AssetImportContext,string,UnityEngine.Object,UnityEngine.Texture2D)

at UnityEditor.AssetImporters.AssetImportContext.AddObjectToAsset (System.String identifier, UnityEngine.Object obj) [0x00001] in <2e279d988b9d4542841de511fbfdf8c2>:0

at SuperTiled2Unity.Editor.SuperImportContext.AddObjectToAsset (System.String identifier, UnityEngine.Object obj) [0x00001] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Importers\SuperImportContext.cs:38

at SuperTiled2Unity.Editor.AtlasBuilder.Commit (System.Single ppu) [0x001bd] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\AtlasBuilder.cs:246

at SuperTiled2Unity.Editor.AtlasBuilder.Build (System.Single ppu) [0x00029] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\AtlasBuilder.cs:88

at SuperTiled2Unity.Editor.TilesetLoader.BuildTileset (System.Xml.Linq.XElement xTileset) [0x00054] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Loaders\TilesetLoader.cs:101

at SuperTiled2Unity.Editor.TilesetLoader.LoadFromXml (System.Xml.Linq.XElement xTileset) [0x0005c] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Loaders\TilesetLoader.cs:41

at SuperTiled2Unity.Editor.TsxAssetImporter.CreateTileset (System.Xml.Linq.XElement xTileset) [0x0008a] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Importers\TsxAssetImporter.cs:62

at SuperTiled2Unity.Editor.TsxAssetImporter.ProcessTileset (System.Xml.Linq.XElement xTileset) [0x00001] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Importers\TsxAssetImporter.cs:45

at SuperTiled2Unity.Editor.TsxAssetImporter.ImportTsxFile () [0x0001e] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Importers\TsxAssetImporter.cs:40

at SuperTiled2Unity.Editor.TsxAssetImporter.InternalOnImportAsset () [0x00018] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Importers\TsxAssetImporter.cs:33

at SuperTiled2Unity.Editor.SuperImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x00065] in D:\Work\UnityWork\hl-client-unity\HerosLand\Assets\ThirdParty\super-tiled2unity\Editor\Importers\SuperImporter.cs:71

UnityEngine.Debug:LogErrorFormat (string,object[])

@Seanba
Copy link
Owner

Seanba commented Sep 14, 2023

Hi there, @streamcypher. It looks like you put Super Tiled2Unity in your Assets folder.
I think that should still work but since version 2.0 ST2U is now a proper Unity Package.
In other words, you unzip the package into your Packages folder.
From there the Unity Package Manager adds it to your project as an Embedded Package.

@Seanba
Copy link
Owner

Seanba commented Sep 14, 2023

Quick question: How do you even import the samples into your project if you've added the ST2U package to your Assets directory?

@streamcypher
Copy link
Author

Quick question: How do you even import the samples into your project if you've added the ST2U package to your Assets directory?

I have tried two ways including putting it to assets foldder and importing from Unity Package Manager. The result and errors is same.

@streamcypher
Copy link
Author

Quick question: How do you even import the samples into your project if you've added the ST2U package to your Assets directory?
I just tried the new version 2.1.1, this problem is resolved. Thanks a lot!

@streamcypher
Copy link
Author

Hi there, @streamcypher. It looks like you put Super Tiled2Unity in your Assets folder. I think that should still work but since version 2.0 ST2U is now a proper Unity Package. In other words, you unzip the package into your Packages folder. From there the Unity Package Manager adds it to your project as an Embedded Package.

This problem arise again when importing the sample from the super-tiled2unity.v2.1.1 package with Unity Package Manager.

@streamcypher streamcypher reopened this Sep 16, 2023
@streamcypher
Copy link
Author

I closed uinty and copy the super-tiled2unity.v2.1.1 folder into package folder in the project, then open unity and importing the sample with package manager, that will not arise the problem.

@Foxeh89
Copy link

Foxeh89 commented Oct 14, 2023

I closed uinty and copy the super-tiled2unity.v2.1.1 folder into package folder in the project, then open unity and importing the sample with package manager, that will not arise the problem.

thank you, this worked for me.

@Haelle
Copy link

Haelle commented Jan 16, 2024

I have the same issue, I'm on Unity2022.3.11 on Linux and using Tiled v2.1.1.

EDIT : this is a Linux problem, the zip is unusable on Linux the files are all in the root directory and have \ in their names where they should be in folders 😫

The process never ends when importing via the package manager. And Unity freeze when copying the directory in the Packages/ folder (or in Assets/)

Any idea ? Linux problem ?

@Haelle
Copy link

Haelle commented Jan 16, 2024

I solved the problem with this script to rename all files (and it works on Linux) :

#!/bin/bash

DIR="/path/to/SuperTiled2Unity"
find "$DIR" -type f | while read -r file; do
    newpath=$(echo "$file" | tr '\\' '/')
    mkdir -p "$(dirname "$newpath")"
    mv "$file" "$newpath"
done

@751500365
Copy link

我关闭了uinty并将super-tiled2unity.v2.1.1文件夹复制到项目的包文件夹中,然后打开unity并使用包管理器导入示例,这不会出现问题。

谢谢,这对我有用。

你确定这样能解决吗。我把包分别放到Asset 目录下和Asset 目录外 通过Package manager form disk 导入 都会出现 Failed to add object of type SuperTile. Check that the definition is in a file of the same name and that it compiles properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants