- Home /
Restore list elements at termination
Hi again Unity community,
I have a spawner that's reading a list of scriptable objects and instantiating them at certain intervals. The scriptable objects have a list of spawn points, and the prefab to instantiate.
When the spawner is done instantiating any scriptable objects from the list, it removes the spawn point from the scriptable object's list of spawn points.
My problem is, I'm having to repopulate my scriptable object's list of spawnpoints every time I execute the game because my spawner keeps removing all elements from the list. How can I make the removal of the list only last temporarily, and return to its original state when I terminate the game?
Thanks!
Use a runtime copy of your list then only iterate over / manipulate that runtime version?
Ahh interesting idea! I did what you said, except I consolidated all of the list values into a sorted dictionary of type spawnpoint, prefab and accessed the keys ins$$anonymous$$d of removing from the list. Thanks for the idea!
Your answer
![](https://koobas.hobune.stream/wayback/20220612192704im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Export objects to a .3DS file at runtime 1 Answer
Trouble with instantiated GameObjects/Model in build 0 Answers
Inheritance Confusion 1 Answer
How to edit 3D Text at runtime? 1 Answer