Are hte UUID's consistantly unique?

In the Core lecture, we had an extra check to ensure that
A, The GUID’s were all unique and
B. That the GUID’s were saved within the scene-data for the Unity Editor itself

So, as this stands, how do we know that the GUID’s will be consistent enough for this to work properly?

How are the UUID’s being generated? I’m guessing (based off the save package Sam constructed) that they’re made with calls to System.Guid.NewGuid() - which is how almost every .net app on the planet also generates unique IDs.

Whilst it is perhaps slightly possible to have a clash, that possibly is so remote as to be not worth considering or checking for; likely smaller than 1 in trillions.

About the only valid use cases for not relying on this to provide uniqueness are in critical financial usages such as bank transactions and cryptography; for everything else it’s good enough.

They used to proclaim things like being able to generate 1000 GUIDs every second for a 1000 years on the same computer, and you probably wouldn’t get a clash.

Personally I’ve only used it in situations (business app dev, not game dev,) where there have been 10’s of thousands of guid generations, and there’s been no clashes in the past 5 years the software is running.

So for game item identification, this would come down to being something you shouldn’t bother spending time worrying about, there’s plenty other things that should demand your attention more importantly :slight_smile:

1 Like

The reason we’re testing for uniqueness in the Core Combat Course is that you can Duplicate an enemy in the scene, in which case the GUID is also duplicated. Actually, this same risk exists when duplicating InventoryItems (like if you have a sword, and you want to make a flaming sword, if you Duplicate the sword, you’ll also need to change the GUID).

Here’s how powerful the GUID is… The game Second Life allows you to create objects, upload textures, etc. All of these objects within the SL world are represented using a GUID. They’ve been using these GUIDs for over 15 years as items are added into the system. To the best of my knowledge, they’ve never had a duplication.

1 Like

Wow, I had no idea that GUID’s were that reliable and powerful! Thank you both for answering my question!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms