How do I pick an instance by UID?

  • Hi,

    this question seems to be stupid, but I have some troubles picking an instance by its UID. The game itself has a lot of objects (about 1.000).

    It's a board game with a big grid.

    On this board I spawn some towers (it's a tower defense game). Then I try to pick an specific tower by it's UID.

    The tower is there, and the UID is matching the UID from the tower. However sometimes it doesn't pick the instance.

    Below you will find the function.

    It works fine if I add tower by tower, but it doesn't work if I add more towers and then call the function shown above.

    Any idea what can the issue could be? I know it's difficult to say with out the capx file.

    I'm using Construct 2 r236 beta.

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Id would stay away from UID and IDD but rather just product a variable for each and just do when created set variable to What ever numbering choice you like in this case if you still want to use UID and then just function.paramter its variable rather then UID or IDD cause lots of time ive seen it reorder the number a couple of time either due to me modified the layout delete stuff and add stuff tend to screw up the UID ordering and or a bug goes un-notice like accident create and self delete lol.

    Think of it like an inventory without using UID.

  • Thanks for your inputs. I made a workaround, so that that I haven't to use the UID. Now it's working fine. However I'm not sure why it doesn't work the way above.

    Thanks!

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