SuperTiled2Unity icon indicating copy to clipboard operation
SuperTiled2Unity copied to clipboard

Custom properties arent importing to unity

Open schecters5150 opened this issue 2 years ago • 7 comments

Hello there!

Im trying to set the unity:IsTrigger and unity:Tag to apply to separate layers withing Tiled. When I click on a layer, I can see them in the Custom Properties pane, but when I move over and reload the prefab in unity, they do not apply. I have everything typed correctly. Do I need to set anything else up to get this to work, or is this a bug that I'm seeing? Sorry if the explanation is brief - I'm not quite sure what information to add to be of help.

Thanks!

schecters5150 avatar Feb 19 '23 21:02 schecters5150

Hi there, @schecters5150. That should be working for you. Do you mind sending me a copy of your project (or a github link?). I usually find it easier/faster to debug such things on report back what I find.

Seanba avatar Feb 20 '23 06:02 Seanba

Hey Sean, thanks for the reply!

Project can be found here - excuse the mess haha.

https://github.com/schecters5150/Monstera2

The Tiled files are found here:

https://github.com/schecters5150/Monstera2/tree/master/Assets/Sprites/GroundSprites/TheGreen

schecters5150 avatar Feb 20 '23 14:02 schecters5150

Hi again, @schecters5150. I'm not able to load your full project because I think some dependencies are missing, perhaps from the Package Manager? I'm getting 999+ compile errors.

However, if I delete everything but ST2U and your Tiled files it looks like the tagging and layer'ing is working to me.

image

Perhaps there is something else in your project that is getting in the way? If I was able to open your project then maybe I could tell.

seanb-22ct avatar Feb 20 '23 17:02 seanb-22ct

Thanks for the quick reply!

Yea, I have a few packages and the like that would probably keep it from running locally for you. One thing I have noticed is that it isnt applying to layer level custom properties within unity

image

image

Just to be double check, if I have the isTrigger set to false on the layer, the polygonal collider is trigger property should be set to false and vice versa, correct?

schecters5150 avatar Feb 20 '23 18:02 schecters5150

I think you have predefined types in Tiled that your Unity project doesn't know about.

You can read about exporting your custom types here: https://supertiled2unity.readthedocs.io/en/latest/manual/custom-properties.html

The main gist is to export you custom types (bring up the Custom Types Editor in Tiled for this) ...

image

(You must export as an XML file into a folder in your Unity project)

Then, in Unity, go to the SuperTiled2Unity settings and import the custom types that you exported from Tiled.

image

You'll need to re-import your TMX files after you make this change. Simply modifying them in Tiled will force the re-import to take place.

Hope that helps.

seanb-22ct avatar Feb 20 '23 22:02 seanb-22ct

Unfortunately, that doesn't seem to have worked either. Oddly enough, when I add the tag to the layer directly within tiled, it appears on the layer level within in unity (eg, the terrain layer has the custom property). Oddly enough though, the isTrigger tag isn't correct within the actual polygonal collider 2d object itself, and mismatches the super tiled tag. Is the box within the component supposed to change on compile to match the tag given in the layer data?

On Mon, Feb 20, 2023, 5:08 PM Sean Barton (22nd) @.***> wrote:

I think you have predefined types in Tiled that your Unity project doesn't know about.

You can read about exporting your custom types here: https://supertiled2unity.readthedocs.io/en/latest/manual/custom-properties.html

The main gist is to export you custom types (bring up the Custom Types Editor in Tiled for this) ...

[image: image] https://user-images.githubusercontent.com/18538373/220204945-17bda834-22f6-4f4e-b106-49ae0b5139be.png

(You must export as an XML file into a folder in your Unity project)

Then, in Unity, go to the SuperTiled2Unity settings and import the custom types that you exported from Tiled.

[image: image] https://user-images.githubusercontent.com/18538373/220205226-6d306329-dccd-4c7f-a0bf-876b9eec301b.png

You'll need to re-import your TMX files after you make this change. Simply modifying them in Tiled will force the re-import to take place.

Hope that helps.

— Reply to this email directly, view it on GitHub https://github.com/Seanba/SuperTiled2Unity/issues/236#issuecomment-1437602472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3WX6LE6HIHFCGJSWZOWPLWYPTNDANCNFSM6AAAAAAVBGAYMU . You are receiving this because you were mentioned.Message ID: @.***>

schecters5150 avatar Feb 20 '23 22:02 schecters5150

Hi again. If I'm reading you correctly then what you're describing is what I'd expect if the custom types XML was not exported (from Tiled) and imported (into Unity) correctly. In other words, Tiled "knows" about your custom types but SuperTiled2Unity doesn't -- so you have default settings that are missing.

I suspect it to be something that is easily overlooked. Let me know when the dependencies within your github project are fixed so that I can pull it down and see what's going on.

seanb-22ct avatar Feb 20 '23 23:02 seanb-22ct