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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OscarS
Posts: 17
Joined: Mon Jul 17, 2023 1:47 pm

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

Post 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 403 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 403 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 403 times
So I'm not sure what the problem is here. thanks in advance!
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
OscarS
Posts: 17
Joined: Mon Jul 17, 2023 1:47 pm

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

Post 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
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
Post Reply