Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Play Mode Save

Discussion in 'Assets and Asset Store' started by pluginmaster418, Aug 20, 2020.

  1. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, thanks for reporting the bug. I'll let you know when it's fixed.
     
    vincurekf likes this.
  2. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
  3. justifun

    justifun

    Joined:
    Apr 2, 2013
    Posts:
    21
    I can't see to get the right click menu to come up. In play mode (in the game scene nothing happens) and in scene view i get right click view navigation instead. is there a setting i need to adjust in the editor or something? thx

    edit: You need to click the component of the object you want to save unless you have "auto save all" options selected in the save play mode inspector
     
  4. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    To display the context menu, simply right-click the component in the inspector.
     
  5. rizorpolder

    rizorpolder

    Joined:
    Feb 20, 2019
    Posts:
    5
    Good idea and good start!
    Have some questions:
    1) Wht about saving across scenes? I have "Scene 1", whitch loading "Scene 2", and i need to save changes on "Scene 2". Saving on exiting playmode isnt works, Save now - same, but when exired from playmode - both of scenes are loaded (but components has no chanded) - is it will be fixed?
    2) How its will be works with prefabs? Nested prefabs? Asset will save "Scene", or apply changes on prefab?
    P.S. No, i cant use playmode on "Scene 2", coz basic logic initializing on Scene 1.
     
  6. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, Have you enabled the auto-apply option?
    I have tried but here it works fine.
    Could you send me a mockup project where I can test the issue? my email is pluginmaster418@gmail.com

    The tool does not apply overrides on prefabs.
    For prefabs created in edit mode. Changes made in play mode will be applied to the object in the same way as if you had made them by hand using the inspector in edit mode.
    For prefabs instantiated in Play mode, the tool will treat them as independent objects, disconnected from the original prefab.

    If you want to modify and apply overrides to prefabs instances instantiated in play mode, you can change your instantiation code like this:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.    UnityEditor.PrefabUtility.InstantiatePrefab(prefab);
    3. #else
    4.    Instantiate(prefab);
    5. #endif
     
  7. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Doesn't work for SerializeReference. Can you solve it?
     
  8. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, Thanks for reporting the issue. I'll try to fix it. Could you send me a mockup project or package where I can test the issue? my email is pluginmaster418@gmail.com.
     
  9. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    In my project it doesn't work, but I tried a minimal demo and it's ok. So, the problem might be in my project, let me test it a little more and let you know the result.

    I've tested many times, but still can't find a specific problem. But it really doesn't work in my project and often crashes Unity.
     
    Last edited: Feb 11, 2022
  10. Holooooo

    Holooooo

    Joined:
    Apr 17, 2020
    Posts:
    1
    Great job!But it seems doesnt work in 20.3.30f1.I try to save Main Camera transform, but it turn back to old value after me exit play mode.
     
  11. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, thanks for reporting the issue, I tried here and it works on unity 2020.3.30f1.
    Could you describe the sequence of steps you followed before the problem occurred?
    Or, could you record a video showing the issue?
     
  12. Stonegolemstudio

    Stonegolemstudio

    Joined:
    Feb 26, 2022
    Posts:
    6
    Is there a new documentation anywhere?
     
  13. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
  14. pholz

    pholz

    Joined:
    Feb 27, 2014
    Posts:
    2
    Hi,

    I just sent a mail but maybe some others have the same issue: When I save a script component, all object references are deleted. Also, it sometimes just doesn't work at all. 2022.2b6. It may have to do with the fact that I am dynamically unloading and loading scenes after startup...?
     
  15. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi. Thank you for reporting the issue. I'll let you know when it's fixed.
     
  16. Game_Taco

    Game_Taco

    Joined:
    Jun 16, 2018
    Posts:
    3
    Hey @pluginmaster418 I’m considering picking this up, but I’m wondering about the limitation in the documentation. Is this limited by the Unity serialization utility, or is it able to work with something more advanced? I often use Odin’s serializer or the Json.net serializer because they support generics and more complicated types, and they're both free.
     
  17. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, Play Mode Save uses Unity's serialization system, so there is no support for generics or more complicated types.
     
  18. tomkail_betterup

    tomkail_betterup

    Joined:
    Nov 17, 2021
    Posts:
    46
    Just bought this plugin - it seems to work great and it's a bargain for the price (try implementing this yourself, it ain't simple!), but I'd assumed it would restore gameobjects, not just component values.
    For those who need this functionality, I wrote a plugin while at Inkle that's free to use. It's a bit scrappy but works in simple cases. Surprised to find that Unity still haven't solved this officially all these years later :(
    https://github.com/inkle/Unity-Save-Play-Mode-Changes
     
  19. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi. You can save objects created in play mode by selecting the object and then in the PMS window selecting "Save all components now" or "Save all components when exiting play mode". Another way to restore new objects created in play mode is to create a parent for the new objects and then add it to the save list by selecting "Always save all components when exiting play mode" in the PMS window.
     
  20. FredTuna

    FredTuna

    Joined:
    Dec 28, 2016
    Posts:
    7
    Hi @pluginmaster418 , I just purchased and installed PMS but realized it might not work for my use case. Our scene is pretty bare to start with and we instantiate most of the world's objects at runtime by instantiating prefabs. Unfortunately, PMS doesn't seem to work when modifying values on objects from instantiated prefabs? Is this correct? If so, is it something that could be added as a feature in the future?

    What I'd love is for PMS to detect that when I modify a property on a component that is part of an object of an instantiated prefab, it recognizes which prefab it is an instance of and apply the changes to that prefab.
     
  21. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, PMS doesn't apply overrides on prefabs.
    If you want to modify and apply overrides to prefabs instances instantiated in play mode, you can change your instantiation code like this:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.    UnityEditor.PrefabUtility.InstantiatePrefab(prefab);
    3. #else
    4.    Instantiate(prefab);
    5. #endif
     
  22. WayneJP

    WayneJP

    Joined:
    Jun 28, 2019
    Posts:
    34
    Got a problem. I have scene A and scene B, I save changes on scene B, then move player to transition to scene A.
    If I back to scene B, the changes on scene B are discarded.
    If I exit the play mode, changes in scene B don't save, and if I click Apply All Changes, the gameObjects I changed in scene B are all dissapear !
     
  23. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Hi, thanks for reporting the issue. I'll let you know when it's fixed.
     
  24. pluginmaster418

    pluginmaster418

    Joined:
    Jun 6, 2020
    Posts:
    155
    Fixed in version 3.7.5. Now available to download.