But... The enum refused to change

public override void SetButtonBlockerType(BlockerType _blockerType)
{
Debug.Log("@SetButtonBlockerType, " + transform.name + ": " + _blockerType.ToString());

    blockerType = _blockerType;
    Debug.Log("New type: " + blockerType.ToString());
}

blockerType is an enum. Both the debug log before and after it report the correct value and transform.name points to the correct object, but the value never changes in inspector, and Debug.Logging the value later also returns to default value set for the prefab, not the one set with that function. Every other reference to blockerType in code is an if statement, no assignments.

The code above is run at runtime and is not modifying the editor

Anyone know what’s up with that? Did I miss something?

Like @eses probably wanted to say in the comment: Do you call that method at runtime or at edit time? If you call it at edit time, where do you actually call it and do you actually mark the object that holds that enum value dirty? The inspector just shows the serialized data.

During playmode the editor constantly serializes the actual values in the instances to a temporary serialized version which is actually shown in the inspector. At edit time the current value is the value serialized to disk (inside a prefab, asset, scene file). The values in the instances do not automatically get serialized, only when the object is “dirty”.

Furthermore at edit time all the EditorWindows only repaint themselfs when they are told to repaint. This of course happens when you input something in an inspector field or when you click one. If you call this method from somewhere else, when the changes aren’t announced to Unity, the inspector will not repaint itself.

You’re missing some important information to properöy answer the question. Your tags aren’t that helpful either.

edit

Ok since we now know that we talk about runtime only the answer is pretty simple: You have to change it manually somewhere. It’s obvious that you don’t know where so the easiest way to figure out where you might change the value is to temporarily replace your variable with a property:

So just replace this:

public BlockerType blockerType;

by this:

[SerializeField]
private BlockerType m_BlockerType;
public BlockerType blockerType
{
    get { return m_BlockerType;}
    set {
        Debug.Log("blockerType changed from " + m_BlockerType + " to " + value, gameObject);
        m_BlockerType = value;
    }
}

Now just run your game and watch the debug logs. Each log has a detailed stacktrace where blockerType has been set. Also note that i passed the current gameObject as “context” parameter. If you click the log message once in the console Unity will highlight / ping the object either in the hierarchy or in the project panel.