ValueDropdownAttribute beaks prefab's connection

Issue #251 resolved
wavebit created an issue
public class Unit : SerializedMonoBehaviour
{
    [SerializeField]
    //[ValueDropdown("SuggestedUnitNames")]  
    //if ValueDropdownAttribute is enabled in the futer,  prefab and its children (gameobjects in scene) will be auto changed to "A", the connections between them are broken.
    //then I have to restore the prefab's children one by one.
    private string _unitName; // say "0" is serialized early

    private string[] SuggestedUnitNames()
    {
        return new string[] { "A", "B", "C" };
    }

    [SerializeField]
    // If "Fly" in UnitType is removed in the future, the prefab and its children are not changed this time, the connections between them are not broken, but show the raw value 2.
It is better to show a raw value or keep empty than auto change.
    private UnitType _unitType; // say "Swim" is serialized early
}

public enum UnitType
{
    Fly, 
    Ground,
    Swim
}

cap.PNG

Comments (1)

  1. Bjarke Elias

    Ah, good catch. Thanks for example. It's changed so that it only modifies the value when changed manually from the drop-down.

  2. Log in to comment