[Suggestion] Show I/UIDs for selected objects

Discussion and feedback on Construct 2

Post » Fri Aug 03, 2012 4:31 pm

the main thing to remember and Ive mentioned this elsewhere. You CANNOT trust those numbers outside of runtime. It doesnt matter if its displayed in the editor or not its not somethin you should depend on goin from edit time to run time.

The IID is basically the index of a specific instance in relation to all the other instances of the same object. Im pretty sure it goes in the order they were created. I dunno if it keeps numbering higher when more are created or if it fills in gaps (instead of making a new IID 10 it would be somethin like 6 if the current ones were 1,2,3,4,5,7,8...)

IID should NEVER be used to point to a specific instance. It should only be used possibly with loops and the like. Its basically a running count. Only in very very specific circumstances would it work out as intended for anything else.

UID (as far as I know) will always be specific to that instance in the entire game. Thus its unique. Once that instance is created you can use the UID to point directly to that instance as long as it exists. Thats not to say that ANOTHER instance wont get that UID IF the first ones been removed.

Its a trustable value to use as long as your aware of how your using it before hand. The main use is to relate one object to other objects during runtime (what your tryin to do with your example here) And it works perfectly fine as long as you take into account the times that instance (and thus its UID) might be unavailable.

When you create an object the next action can set a variable to the UID of that created object. That variable can then be used to pick that specific instance of the object. If and when that instance is removed you need to set that variable to somethin else (like another UID of a newly created instance) or a value you consider "null" and use that value to determine if you CAN use the value to interact with the intended object.

Basically IID is only useful for counting/looping for the most part. UID is the value to use but only if you set it on creation during runtime and take into account it possibly changing
Posts: 306
Reputation: 3,262

Post » Sat Aug 04, 2012 4:25 am

I only use UID and IID when dealing with things I don't create more of or delete, which are my game's buttons.
It's pretty useful as with it, in my level selection, I managed to reduce about 25 events into one with using their UID to send them to their levels.
Posts: 963
Reputation: 11,261

Post » Thu Aug 16, 2012 2:03 am

After researching and trying to see over the fence, I figured out a solution about the indexing objects issue.


It's really awesome, and Ashley was trying to say it all the time, but when you don't have the knowledge behind the scene, it's difficult to figure out.

Maybe later I do a Tutorial explaining about it and other things to help everyone else.
Posts: 1,391
Reputation: 23,017


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests