You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Sean, I've got a custom importer that modifies objects on an object layer in Tiled that are marked with a custom property.
I am adding a component and setting a tag value to each object with the custom property. the tag value will match the property value.
Everything works fine on import. the component is there and the tag is set BUT it seems the map is not being set as dirty because when i close and reopen the editor, the component and tag are missing and the map has to be reimported.
I checked my code again against the example provided and didn't notice any step to set the map dirty.
When I added this to the script it does seem to solve the problem so I would suggest adding that to the example or perhaps add some cleanup step to the import routine to do this behind the scenes.
EditorUtility.SetDirty(args.AssetImporter);
(i just searched for SetDirty in your code to see what was missing and found it in the TiledAssetImporter.ApplyDefaultSettings method so i knew that was probably the issue on my side)
The text was updated successfully, but these errors were encountered:
Hi there, @mikest34. Thanks for the advice but a question remains: Where do you suggest I add the call to EditorUtility.SetDirty();? If you could be a little bit more specific that would be great. Thanks.
// The AutoCustomTmxImporterAttribute will force this importer to always be applied.
// Leave this attribute off if you want to choose a custom importer from a drop-down list instead.
[AutoCustomTmxImporter()]
public class MyTmxImporter : CustomTmxImporter
{
public override void TmxAssetImported(TmxAssetImportedArgs args)
{
// Note: args.ImportedSuperMap is the root of the imported prefab
// You can modify the gameobjects and components any way you wish here
// Howerver, the results must be deterministic (i.e. the same prefab is created each time)
var map = args.ImportedSuperMap;
Debug.LogFormat("Map '{0}' has been imported.", map.name);
// You also need to se the imported asset dirty if you make changes to it
EditorUtility.SetDirty(args.AssetImporter);
}
}
Hi Sean, I've got a custom importer that modifies objects on an object layer in Tiled that are marked with a custom property.
I am adding a component and setting a tag value to each object with the custom property. the tag value will match the property value.
Everything works fine on import. the component is there and the tag is set BUT it seems the map is not being set as dirty because when i close and reopen the editor, the component and tag are missing and the map has to be reimported.
I checked my code again against the example provided and didn't notice any step to set the map dirty.
When I added this to the script it does seem to solve the problem so I would suggest adding that to the example or perhaps add some cleanup step to the import routine to do this behind the scenes.
EditorUtility.SetDirty(args.AssetImporter);
(i just searched for SetDirty in your code to see what was missing and found it in the TiledAssetImporter.ApplyDefaultSettings method so i knew that was probably the issue on my side)
The text was updated successfully, but these errors were encountered: