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

CustomTmxImporters can interpret Tiled properties of type "object" #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vvnurmi
Copy link
Contributor

@vvnurmi vvnurmi commented Jan 5, 2023

Added method TmxAssetImporter.GetObject(int id). It enables custom TMX importers to interpret Tiled properties that are of type "object". For example, in an overridden method CustomTmxImporter.TmxAssetImported(TmxAssetImportedArgs args) you can do this:

GameObject go = ...;
int objectId = go.GetSuperPropertyValueInt("myObjectProperty", -1);
GameObject otherGo = args.AssetImporter.GetObject(objectId);

This enables custom TMX importers to interpret Tiled properties that
are of type "object". For example, in an overridden method
CustomTmxImporter.TmxAssetImported(TmxAssetImportedArgs args)
you can do this:

GameObject go = ...;
int objectId = go.GetSuperPropertyValueInt("myObjectProperty", -1);
GameObject otherGo = args.AssetImporter.GetObject(objectId);
@Seanba
Copy link
Owner

Seanba commented Jan 6, 2023

Hi there. I think this looks good.
I'm currently in the process of converting ST2U to be used as a package (in the Package Manager) instead of being distributed as a *.unitypackage file.

That has forced me to re-arrange the code a bit but I'll remake your changes in the branch I'm working in. Thanks.

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

Successfully merging this pull request may close these issues.

2 participants