Skip to content

Bug: Object properties should be nullable without errors on importation #313

@rasgou

Description

@rasgou

When I have a custom property of type object in Tiled (e.g. on a class), I don't necessarily want it to be required. A perfectly valid design is needing nullable object properties, which accept a null value (object ID 0) if I may or may not assign a value to that property on the class instance.
Example use case: some enemy may set a path to follow/patrol while another may not set one (to stand still in place). There's a zillion other valid use cases for null values in object fields.

But currently, if I try to import a map with a null value for an object property I get this:

SuperTiled2Unity version: 2.4.0, Unity version: 6000.3.6f1
Errors Detected. Your Tiled asset may not function correctly. Please follow directions to fix.
Generic Errors
Object property refers to invalid ID 0

This error should just be ignored for ID zero, because since Tiled has no way to set nullability of properties, the plugin should be lenient and assume all properties are nullable. After all, Tiled editor itself shows no error for object properties left unassigned.
If the id is non-zero and it's missing, then yes, show the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions