JimmyCushnie/JECS

Allow base types to be loaded when serialized as a complex type

JimmyCushnie opened this issue · 2 comments

Consider the following type.

struct Color
{
    public byte r;
    public byte g;
    public byte b;
}

If we save it as SUCC, it will look something like this:

color:
    r: 120
    g: 142
    b: 69

Now suppose later we make Color a base type, saving and loading it as a hex code:

color: 788e45

At this point, SUCC will be unable to load the first example, as base types must ALWAYS be saved and loaded as their single-line value.

Proposal: if SUCC tries to load a node as a base type, and that node has child nodes, SUCC should treat the base type as a complex type.

Also: if a node has a value and no children, but it fails to load as a base type, try loading it using complex type shortcuts.

Added this feature in 97b6974 :D not sure why it didn't automatically close the issue.