samedi 13 juin 2015

Giving objects unique ids onStart

I have a bunch of gameObjects that I am assigning unique ids to in the Start function.

void Start() {
    UniqueID = String.Format("{0:X}", DateTime.Now.Ticks);
}

I thought this would work but every now and then I get duplicate ids. How can I make sure that they are always unique?




Aucun commentaire:

Enregistrer un commentaire