Is it possible to save changes made in editor in playe/paused mode?

Is it possible to save changes made in editor in play/paused mode? By default changes made while project is running are not saved to scene. I know this is good and done on intention. But is it possible to force Unity update scene or modified prefab when in play mode?

1 Like

You can but it requires custom editor scripts. I would recommend the Playmode Persist plugin from the asset store. It is not free though.

An alternative is to make sure you do not accidentally start editing in playmode, one way I have heard works great is to set your playmode tint color to something vastly different from normal editor color. You can do that if you go to Edit - Preferences - Colors. There you can edit Playmode Tint. Set it to something bright like all Green or similar and you will definitely know from the entire editor that you are in playmode and then probably not start editing by accident.

If after all that you have still accidentally edited something in playmode you can still save something by making it a prefab or copy specific components while you are in edit mode. This depends on what you have edited though, but take for example if you have a GameObject with a controller script that has a lot of values, and you edit all those values in playmode. You can then drag the gameobject into the Asset list and you will have made it a prefab, then stop playmode and drag the prefab out into the scene again. You can also instead rightclick on the component itself and choose: Copy Component. Then stop playmode and right click again on the same component and choose: Paste Component Values.

You can copy / paste the component values.