This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I want to give each object an unique id (like for example in Minecraft).

Should I use the uuid system (Godot Asset Library) or an global counter for this?

What are the advantages and disadvantages?

in Engine by (226 points)

1 Answer

0 votes

Yes, if you wish to guarantee uniqueness. I think the only really glaring disadvantage is sorting.

A global counter may be fine for you application if you can guarantee thread safety (i.e. they're handed out atomically and nobody else can get the same ID; some kind of ID manager, perhaps) and also that the type doesn't overflow.

by (1,406 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.