Set Dirty and Save Scene

Hi. I had wrote a custom inspector for some class Container. This class contains an array (public) of serializable class ContainerItem. From my custom inspector I vary this array, and if some changes to this array applied I use EditorUtility.SetDirty(container);

This works just fine, items added through inspector are there on playmode and after. But. But if I add item and close Unity changes not saved. And if I add item and click Ctrl+S (although unity not saying there were changes on scene), then item is saved after reset.

I’m not too experienced with custom inspectors and serialization and whatewer. Why unity not saying there are changes at scene to save? How to force editor to save scene or to track changes?
I just need it at least to remind me to save changes.

Thanks. I use ScriptableObjects for many things in my projects. Just thought that’ll be too cumbersome in this case.

So, I decided to use SerializedObjects instead

var serialized = new SerializedObject(container);
var items = serialized.FindProperty("Items");
container.Items[container.Items.Length - 1] = containerItem;

Now I get “Save Changes?” window on shutdown. But then I though, meh, what the heck, and ended up with a single line: