Saver keys

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SealDev
Posts: 85
Joined: Thu Jun 24, 2021 5:45 am

Saver keys

Post by SealDev »

If I have multiple levels with objects with the same name and I use the "Assign Unique Keys" tool, is there a very low chance 2 savers will get assigned the same identifier key number? (Example: "SAVER_931386"), or does the system know how to check if a key has already been used in the whole entire project?

Might be a very small chance for now, but if I duplicated 1000 scenes that contain that "SAVER" gameobject, the chance of overriding a past key would become much larger.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saver keys

Post by Tony Li »

Hi,

Yes, there's a very, very low chance of duplicates -- not as low as using GUIDs, but still very low, and these key values are shorter than GUIDs. You can assign keys manually if you're concerned.
SealDev
Posts: 85
Joined: Thu Jun 24, 2021 5:45 am

Re: Saver keys

Post by SealDev »

Right now, chance is 1 in a Million because the saver keys generate with 6 digits.

Is there a script where I could easily add 1-2 more digits to the "Assign unique keys" tool, so that the chance becomes 1 in 100 Million?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saver keys

Post by Tony Li »

You could assign keys manually or tick the savers' Append Saver Type checkbox. Or you could duplicate SaveSystemEditorUtility.cs, change the class name, and modify the AssignNewKey method to use something like System.Guid.NewGuid() instead of saver.GetInstanceID() to generate the key.
Post Reply