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

No SuperCustomProperties for Tiled objects #87

Closed
Dalqin opened this issue Jul 26, 2019 · 2 comments
Closed

No SuperCustomProperties for Tiled objects #87

Dalqin opened this issue Jul 26, 2019 · 2 comments

Comments

@Dalqin
Copy link
Contributor

Dalqin commented Jul 26, 2019

I have a Tiled map with some objects in an object layer, using a ObjectType to map a Tiled object to a treasure chest prefab when importing the .tsx map file into Unity. In Tiled, this object has custom properties. I was hoping to see a SuperCustomProperties component with these custom properties upon importing my .tsx map into Unity, but I do not see a SuperCustomProperties component on my imported object.

Tiled - showing custom properties on an object
image
Unity - hoping to see SuperCustomProperties with my "ItemData" property.
image

Looks like the Tiled object, my treasure chest, is being replaced with an GameObject identical to my treasure chest prefab (but not an instance of my prefab) with no custom properties that I can find. Am I looking in the right place?

I've two questions, assuming I have not made a mistake in setting this up:

  1. Is there a way to get custom props on objects imported into Unity without any custom import script? My goal is to have a prefab treasure chest and use a custom property to define what item the treasure chest should reward the player when opened.
  2. I found it interesting that the imported object is a replica of my prefab, but not an instance of the prefab. Was this an intended design decision or just how things came to be?

Thank you!

Seanba added a commit that referenced this issue Jul 27, 2019
Use the PrefabUtility to instantiate prefabs when doing a prefab replacement.
This appears to use "true" prefab instances instead of cloning the prefabs used.
Bumped version to 1.5.3
@Seanba
Copy link
Owner

Seanba commented Jul 27, 2019

Hi there, @Dalqin.

I wasn't aware that prefab instances were not being instantiated/referenced correctly. Can you check out the recently updated version 1.5.3 of SuperTiled2Unity? I'm now using a different method for instantiating prefabs and it appears to be working for me as expected.

As far as Prefab Replacements go and their relationship with Custom Properties this is something I handle through setting properties, fields, or methods on the prefab that is replacing the Tiled Object.

See this repository, and in particular this part of the documentation: https://github.com/Seanba/SuperPrefabReplacement#custom-properties-supported

@Dalqin
Copy link
Contributor Author

Dalqin commented Jul 27, 2019

I checked out 1.5.3 of SuperTiled2Unity and see my treasure chest Tiled object being imported as an instance of my treasure chest prefab in Unity. Yay!

The documentation you linked shows me I was expecting incorrect behavior regarding objects and custom properties. I was able to get my ItemData property value in Unity using a same-named public property, so thank you for pointing me in the right direction there. (And sorry for not reading all the documentation first!)

I dub my issue solved, and will close this ticket.
Thanks very much for the quick reply!

@Dalqin Dalqin closed this as completed Jul 27, 2019
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

2 participants