Page 1 of 1

Error with Persistent Active Data "Invalid OperationException: Collecion was modified; enumeration operation may not

Posted: Mon Nov 06, 2023 3:26 pm
by OscarS
Hi!

I have a problem when trying to use the Persistent Active Data. When I attach the component to 1 object and set it up like this:
example 1.png
example 1.png (16.97 KiB) Viewed 407 times
I can save and load the game and the object will work as intended, but I receive this message on the Console:
example 2.png
example 2.png (21.33 KiB) Viewed 407 times
Finally, when I use the component on more than 1 object, then when I load the game, only the first object will follow the correct behavior and the second will just be active, also I can see that on that object the "Last Check" is set to "none"
example 3.png
example 3.png (15.17 KiB) Viewed 407 times
So I'm not sure what the problem is here. thanks in advance!

Re: Error with Persistent Active Data "Invalid OperationException: Collecion was modified; enumeration operation may not

Posted: Mon Nov 06, 2023 4:09 pm
by Tony Li
Hi,

Instead of using Persistent Active Data, I recommend setting up the full save system and using an Active Saver or Multi Active Saver component. Persistent Active Data is a legacy component from before the save system was introduced.

Re: Error with Persistent Active Data "Invalid OperationException: Collecion was modified; enumeration operation may not

Posted: Thu Nov 09, 2023 4:59 pm
by OscarS
Hi, thanks for the reply. The Save component works perfectly.

But I just have 1 question about these components. What's the difference between the "active saver" and the "multi-active saver"? As I understand, the "Multi-Active Saver" can save the state of multiple game objects individually, so in a particular case it can save the state of 1 game object or all the game objects that require to be saved.

Is this correct? When is a good option to use each one?

Thanks

Re: Error with Persistent Active Data "Invalid OperationException: Collecion was modified; enumeration operation may not

Posted: Thu Nov 09, 2023 5:02 pm
by Tony Li
Hi,

Active Saver is a little simpler to set up when you only need to track the active/inactive state of one GameObject. But it's perfectly fine to use a Multi Active Saver to track the state of a single GameObject or multiple GameObjects.