I greatly would benefit from a way to permanently save changes to a gameobject made in playmode.
I realize you can use the “Copy component” option from the gear icon – but this only works for one component at a time.
It should be dropping in 2018.x as far as I remember. This is a thread that belongs in general (moved). The forums like Scripting are for actual scripting help, like how to code xyz or problem solving.
how would this work, there are a lot of cases where i would not want to save any changes as well. like if you made a change in playmode, do you get a apply button you can hit before exiting?
What I would like to see is the ability to serialise an entire game object hierarchy at runtime. Which would solve your issue. And it would make supporting saving and loading much simpler.
scriptable object based design survives reloading, and you will want to do that for a better project, overall
ECS stuff (nuff said)
you can right click, copy component, and after play mode, paste component values (or entire copied gameobjects if you want)
Generally just switching to scriptableobjects makes this all go away, so it’s not really a major issue plus everyone is used to using play mode now, to mess it up, then feeling relief when it’s put back in place after play mode.
So if you use ScriptableObject based data, you probably don’t even need this feature. Not saying your request is invalid, just sharing my own findings.
Well, technically they aren’t doing anything. They’re just not bound to the scene. To resolve this you need to keep track of the previous values, if that’s your situation as outlined here under follow up:
(but you know all that already, and I add this for future readers).
I’m in two minds if I ought to instantiate or not. Currently, my ScriptableObjects are designed for delegate functionality and are abstract classes, so the actor will just pick up a monobehaviour container for the SO, and it’ll tell the actor how to use it, as well as being able to construct it’s own physical representation if it needs to… solves a lot of twisted code problems but my instinct is not to give things dual purpose.
I don’t think I’ve ever been happy with a paradigm or pattern in any modern language though, so this isn’t too bad.
Our team only once needed to save changes in play mode. Of course some people would benefit from this feature, but I personally think Unity should concentrate on other areas.
We can solve this problem ourselves with better designs and in the very odd cases, where you do need to selectively save a change, you can write a small script. I can post some code, if anyone is interested, but the gist would be to simple save all fields to either json or other strings and then restoring them on enter edit mode to actually persist the changes in the editable scene. Saving can simply mean in a static variable or a temporary location to store in while exiting play mode. To tackle UnityEngine.Object references, we had success with EditorUtility.InstanceIDToObject.