Including a field that references an [InlineEditor] scriptable object breaks/ignores Undo commands

Issue #416 resolved
Richard Baxter created an issue

I have a script that refernces a scriptable object

public class LineDrawnSymbol : MonoBehaviour
{
    public SymbolLineData symbolData;
    public float lineWidth = 0.05f;
    public float dotWidth = 0.15f;
}

and scriptable object

[CreateAssetMenu]
[InlineEditor]
public class SymbolLineData : ScriptableObject
{
    [System.Serializable]
    public class Point
    {
        public Vector2 position;
        public enum Corner {Sharp, Circular, NewLine}

        public Corner cornerType;
    }

    public List<Point> points = new List<Point>();
}

when I change a field in the scriptable object inside the monobehaviour, the undo works as expected (ctrl-z and it undoes the change)

However when I'm changing a field in the MonoBehaviour, like lineWidth while the scriptable object is expanded/folded-out, pressing ctrl-z does not Undo that change, as if the action was not registered for Undo in the Monobehaviour.

if the scriptable object reference in the MonoBehaviour is collapsed, the MonoBehaviour's undo works as expected

Removing the [InlineEditor] tag from th scriptable object fixes this behaviour in the MonoBehaviour. It's as if the inline-ness is preventing undos from registering in the monobehaviour and only registers for the inline drawn scriptable object

Comments (2)

  1. Log in to comment