I am currently running into a problem while combining the use of templates (just drag and drop them on the map) and my custom scripts.
So far, when processing an object that was created by using a template, I have not been able to access the values of properties where the property still has the default value specified by the template (aka values that are greyed out in the UI).
I also don’t find a reference to the template on the object (even the type property is not set).
The resolvedProperties are working nicely for my custom properties on the template. Thank you.
The non-custom property ‘type’ is unfortunately not retrievable by this, but for that, I can work around by adding a mirrored custom property with the same value as it is stored in ‘type’.
As of 1.9, there is no longer a “type”, there’s “className” instead, maybe that’s the problem? (I don’t know if that’s present in template objects though, maybe it’s not.)
Well, MapObject.type is still there for compatibility reasons. But the problem here is that there is currently no scripting access to MapObject::effectiveClassName, which takes into account tile objects and templates.
Also, I think in Tiled 1.8, accessing MapObject.type actually returned a type set on the template if it wasn’t changed for the instance, so it’s not entirely backwards compatible.