简体   繁体   中英

How to restore unsaved objects back in the scene in unity?

I am looking for ideas or ways to load unsaved objects back in the scene when the Load() method is called from the pause menu or menu screen. ie items I have picked up and/or enemies I've recently killed before autosaving or saving manually. items are scriptable objects, but the enemies are just normal objects present in the scene. I want it to be somewhat memory efficient, I am not sure if setting its status to inactive would be sufficient, instead of destroying it altogether. Thank you in advance.

Can't you just reload the scene and if you have saves you should be able to just reload and modify the scene based on save data.

You may need to add more info about your project, because right now I can only assume what it looks like and what exactly are trying to achieve.

For memory efficiency you should probably just disable enemies instead of destroying them (given that you'd have to clone them in order to respawn). It'd certainly be more memory efficient than having to manually set the position/rotation again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM