How to save a Material at runtime?

The Expose on Spawn could probably work if it also saves if you quit, but how can i set the DMI in my MainMenu?