Do UIDs get recycled?

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm creating two test maps (coming from TMX) and implemented a 'room transfer', where I can move between maps. I do this by deleting the tile instances (and other bits related to it).

    Now, I finding something curious: the UIDs of the tiles I'm generating and destroying just keep on going up and not being 'recycled'. My question is, does it matter? Is there an upper limit of UIDs? Or they get recycled after reaching a limit?

    By the way, yes, I have checked the debugger, and my objects and instances are not increasing in number. They are indeed being deleted.

    Thanks!

  • uid's are the order of objects or the number of object that is created, for example, you got 100 different objects created then you destroy them , the next object will have the uid 101 and not 1 ...

    for the object order to recycle you need to use IID which is the order spawned for each object of same type...

    while uid is the order of any object, all objects created no matter the type of them.

    if that doesnt cut it, you can make a localvariable on tile objects, and for each tile seed assign the count based on a loop.

    ex : for each tile slot add to variableid 1+loopindex if you want to start the counting from 1 and not from 0.

  • , thanks for your reply. You are probably referring to me picking instances consistently? I'm not actually picking instances nor need to refer to them, but rather simply generating instances for a map and deleting it to clear the map for in indefinite number of times.

    However, your first sentence confirms it enough for me, thanks. I was just wondering if, internally, in the game engine, there was some significance to ever-increasing UIDs...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • In the editor, it does actually recycle UIDs, to keep them low-ish. (Otherwise if you deleted all your objects and added a new one, it would have a high UID - this way it goes back to being low.) However at runtime UIDs keep incrementing by 1 for every new object, they are never re-used. The limit is the integer limit of Javascript's double-precision floating point numbers, which is 9,007,199,254,740,992 (9 quadrillion I think that's called?). Hopefully high enough

  • Ashley, I believe, yes, that's a fairly reasonable upper limit. :- ) Thank you for the reassurance.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)