the object type key (built-in type or Tiled class/name)
factory function with signature (settings, map) => Renderable
// register a custom factory for "Spine" objects in Tiled
// (set the object class to "Spine" in Tiled, and add atlasFile/jsonFile custom properties)
registerTiledObjectFactory("Spine", (settings, map) => {
const obj = new Spine(settings.x, settings.y, settings);
obj.pos.z = settings.z;
return obj;
});
Register a factory function for a given Tiled object type. When a Tiled map is loaded, objects are matched to factories using the following priority: object class → object name → structural type ("text", "tile", "shape").
Built-in structural types are:
"text","tile","shape". Custom types are matched against the object's Tiledclassornameproperty.For simple cases where you just want to map a Tiled class to a constructor, use registerTiledObjectClass instead.