Issue: Pick instance by UID

Get help using Construct 2

Post » Mon Jun 03, 2013 12:39 pm

Hi everybody.

I wasn't sure where to start this topic, so I apologize if I'm not at the right spot.

I ran to a strange issue with the "Pick by unique ID" event. This is how it looks:


The problem is that the "Chrome log" action is being ignored as if the "pick instance" event never occurs. It works fine if I do it this way:

Which confirms that the instance I want to be picked is valid and therefore the event is valid, and yet the event still doesn't work.

I also tried this way for the sake of testing:

And I get this warning in the Chrome console:
Kurajber2013-06-03 12:44:01
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Mon Jun 03, 2013 1:11 pm

This sounds like everything is working perfectly normally. If the 'Pick instance with UID' condition is not met, it does not run the event actions (so does not log anything). If you log text in the 'On function' event, it always logs text first when the function is called, then after that tries to pick an instance with a UID (which may or may not work). Nothing is amiss here.

The console log message refers to a different function, called "highlight block". It's unrelated, the event you've shown uses a function called "MyFunction".
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Mon Jun 03, 2013 1:30 pm

Sorry for the "MyFunction"/"Highlight block" mismatch, I updated the screenshots, but they were only misleading from the real issue, I assure you it is just a pre/after-rename thing (the initial name of the function was "highlight block", then I renamed it to "MyFunction" for the purpose of this topic, made the first 2 screenshots, renamed it back to "highlight block" and made the last screenshot afterwards). The issue still stands, I am sure there's an instance with UID 14 and yet the "pick by UID" event still doesn't work.Kurajber2013-06-03 13:35:29
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Mon Jun 03, 2013 1:40 pm

Just to keep it clean, the issue is that "pick by UID" doesn't work even thought the instance that's supposed to be picked does exist and is valid.
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Mon Jun 03, 2013 2:46 pm

How many parameters do you call your function with ? The Param collection is 0-indexed and you are using "Param(1)", is it intended ?Magistross2013-06-03 14:46:38
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon Jun 03, 2013 9:03 pm

I call the function with 4 parameters and it's the 2nd parameter I'm retrieving to pick an instance, so yes - Param(1) is the correct one. I've checked and confirmed that the parameter is retrieved correctly, the "picking part" is somehow being ignored.Kurajber2013-06-03 21:06:57
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Mon Jun 03, 2013 9:14 pm

Are you calling the function directly using "14" as a parameter ? Try logging every instance UID to see if there's actually one with the UID "14". If in fact there is, then this one will be confirmed as a bug !Magistross2013-06-03 21:15:17
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon Jun 03, 2013 10:27 pm

Yeah, I tried that, the problem persists.
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Tue Jun 04, 2013 8:22 am

Seems like I've been using a slightly outdated version, I just read this:

"Please note the following breaking changes since r126:
In some rare cases, pick by UID can act differently. This should be easily resolved by adding a 'for each' loop above the condition."

I updated to r132, the bug seems to have been fixed. Now it works great without any change in the code (I didn't even add a "for each" loop). Thank you both for your answers and sorry for alerting you for an outdated bug.Kurajber2013-06-04 08:25:56
B
10
S
2
G
2
Posts: 29
Reputation: 1,710


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 42 guests