Real hierarchy data in objects

Discussion and feedback on Construct 2

Post » Sat Nov 28, 2015 1:27 pm

@R0J0hound Ashley words:
"IIDs and UIDs in the editor don't change depending on the Z order, but they do change if you delete and insert instances. Because of this you should not rely on knowing UIDs or IIDs in advance at all - the instance with UID 3, for example, could change to a different object if you add or delete some things in the layout view. This could easily break your game or make it work differently "randomly" (it will seem random to many users because they won't realise certain things they did changed the UIDs and IIDs). For this reason I don't think UIDs or IIDs should ever be displayed in the editor, in order to discourage this bad practice."

A real parenthood will never change, doesn't matter how many instances you destroy or create.
B
19
S
3
Posts: 93
Reputation: 1,004

Post » Sat Nov 28, 2015 1:50 pm

They don't change at runtime, until they are destroyed.
Also the z order part has also changed for the editor.
That's a pretty old quote. The fact that ids can now be seen in the editor tells you that.
Image ImageImage
B
168
S
50
G
164
Posts: 8,236
Reputation: 105,591

Post » Sat Nov 28, 2015 7:14 pm

@kingpirux
What newt said. I was using the uids at runtime, where they never change. Setting up the hierarchy from the editor is a different issue, but still can be done with an instance variable to give each instance a unique value. Just be careful not to give two instances the same value.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Mon Dec 07, 2015 10:00 pm

perfect! if the uid is locked, then it's easier to create the herarchy, as i said, it's an array storing all the uids of the family, father, and sons (or just fathers) and being reach by "object.father" or "object.isfamily" to know if its a son of my father or my grandfather, other one "object.uncle" to reach an object that was created by an object created by my father (for example, attacks of friendly npc's)
B
19
S
3
Posts: 93
Reputation: 1,004

Post » Fri Dec 11, 2015 5:25 pm

Ok just to be 101% sure, the UID stays the same throughout the life of an object? I've been assuming "Yes" for quite a while :-\
B
13
S
4
Posts: 280
Reputation: 1,573

Post » Fri Dec 11, 2015 5:56 pm

@locohost
yep.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests