sttz / trimmer

An editor, build and player configuration framework for the Unity game engine.
MIT License
104 stars 8 forks source link

Variant that has child looks weird #26

Open alijaya opened 1 year ago

alijaya commented 1 year ago

Screenshot 2023-10-17 at 01 41 40

alijaya commented 1 year ago

In ProfileEditor, changing the order of iterating child first than variant seems working

From this

protected void OptionGUIRecursive(Option option, int depth = 0)
{
    if (!OptionGUI(option, depth)) return;

    if (option.IsDefaultVariant) {
        if (!OptionGUI(option, depth + 1, showDefaultVariant: true)) return;
    }

    foreach (var variant in option.Variants) {
        OptionGUIRecursive(variant, depth + 1);
    }

    foreach (var child in option.Children) {
        OptionGUIRecursive(child, depth + 1);
    }

}

To this

protected void OptionGUIRecursive(Option option, int depth = 0)
{
    if (!OptionGUI(option, depth)) return;

    if (option.IsDefaultVariant) {
        if (!OptionGUI(option, depth + 1, showDefaultVariant: true)) return;
    }

    foreach (var child in option.Children) {
        OptionGUIRecursive(child, depth + 1);
    }

    foreach (var variant in option.Variants) {
        OptionGUIRecursive(variant, depth + 1);
    }

}
sttz commented 1 year ago

It seems variants with children are a bit broken. The child options should be shown as part of the default variant, not a level higher up as they are now and identical to how they are shown for non-default variants.

alijaya commented 1 year ago

Ah I see... but functionally, it works... just a little inconvenience