x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

problem with select node and arrays

Branch: Binary

Build version: 4.2.0-2092659

I think I found a bug with the Select node.

In my project I would need to fill one of two variables depending on context. So I use my two different variables, which are arrays, to feed the two inputs of the select node.

I took the problem out of my context and simplified it as much as possible. To the point that it is irrelevant to use as is in a real context, but it shows clearly what is wrong. Since an image is better than a thousand words:

alt text This works as intended and spams 55 and 66 on the screen.

alt text This does not work, the variable does not get updated and it spams zeroes on the screen.

Is it a bug, or am I missing something?

Product Version: Not Selected
Tags:
more ▼

asked Jul 10 '14 at 04:41 AM in Bug Reports

avatar image

Grumzy
51 3 6 7

avatar image [Epic] Gribbs ♦♦ STAFF Jul 10 '14 at 06:46 PM

Howdy Grumzy,

Thank you for your bug report. Just wanted to ask a few more questions about your blueprint setup. In the 'Debug Multi Use' node, I imagine that you have 2 or more default values in the details of that node, correct? That was the only way that I was able to have the 55 and 66 appear on the screen in the first screenshot that you have provided.

Also, I believe the zeroes are showing up because the default values of that Debug int node are zeroes. If i changed the one of the default values to 1, I would see 1,0,1,0,1...... I believe that the select node is directly referencing the default values of the int node and not the values that are plugged into the 'Set Array Elem'.

If possible, could you try and change the default values of the 'Debug Multi Use' Node and let me know what your results are when you have when you have the select node hooked up?

Thanks and have a great day!

avatar image Grumzy Jul 10 '14 at 08:44 PM

Thank you for your answer Sean.

You are right, in the default tab I have 2 default values, both containing a zero value. And yes, whatever these default values are, let’s say 8 and 9, they are the numbers that gets spammed on screen (8,9,8,9…). I will use the 8 and 9 default values for the following test.

That precisely describes the problem that the Select node does not work with the Set Array Elem node. My guess is that it compiles because every pins are compatible, but the Select node allows only data to move from left to right, and not from right to left (with the Set Array Elem), and I think it should.

... I believe that the select node is directly referencing the default values of the int node and not the values that are plugged into the 'Set Array Elem'.

As a precision to that statement, the select node references the last values stored in the variable and not the defaults one.

Here is a more complete test: alt text

As you can see, the final variable values are 11 and 22, and I would expect them to be 55 and 66.

Note that on this screenshot the Print String node is now fired directly from the variable and not from the Select node, but in both case I get the same unexpected result.

combined code.png (141.8 kB)
avatar image [Epic] Gribbs ♦♦ STAFF Jul 10 '14 at 09:52 PM

Hey Grumzy,

I was working with the Blueprint that you have shown and think I may be on to something. Have you tried changing the 'Select' Node to 'Select Int' instead?

avatar image Grumzy Jul 10 '14 at 10:42 PM

The Select Int node only takes non-array as input/output, it would not take an array of Int.

Anyway, in my real project i would like to use the Select node to control arrays of a custom Structure i made. I used an array of Int in my examples only to simplify things, but the unexpected results are all the same.

avatar image [Epic] Gribbs ♦♦ STAFF Jul 18 '14 at 03:05 PM

Howdy Grumzy,

Sorry about the delay in response to your issue. I reached out to another Dev for some feedback on the issue and think that the issue may be that when the 'Int' variable is feeding directly into the 'Select' node, it is only getting the numbers from the 'Int' variable and not the 'Set Array Elem' item numbers. If you place the 'Select node' after the 'Set Array Elem', then the 55 and 66 numbers will be feed into 'Select". Here is the Blueprint I have set up:

alt text

Let me know if this helps out with your issue. Thanks and have a great day!

avatar image [Epic] Gribbs ♦♦ STAFF Jul 23 '14 at 04:17 PM

Hey Grumzy,

Just wanted to check in with you and see if my previous response helped to clear up the issue. If not, please let me know so that I may further investigate the issue.

Thanks!

avatar image Grumzy Jul 23 '14 at 10:18 PM

Hi Sean,

I thank you for trying to help me work around the issue, but the point of this post was more reporting what I thought was a bug than seeking for alternatives. (English is not my first language, I hope this doesn’t sound rude). I can think of some ways to organize my code without the buggy “Select” / “Set Array Elem” combo. When I first wrote this report I didn’t have an elegant alternative, but since then I found a decent solution.

That said, I need to comment on your last code sample - It doesn’t allow the use of 2 or more array variables. I hope you realize that in the real situation I do not use the same array variable to feed the 2 (or more) entry pins of the “Select” node. In my previous code samples I simplified the example as much as possible to pinpoint and make it obvious what I think is wrong. It was a simplified demonstration, it was not a real life situation.

The real code I would like to use is more like this: alt text

The bug is simply that you cannot set an array element through a “Select” node. I think this combination of node should work. Of course you guys can decide that it works as intended and I will be ok with that, but then at least there should be a warning when compiling this combo because as it is now, everything plugs correctly and everything compile, but it doesn’t return the expected result.

The solution I found: alt text

avatar image Grumzy Jul 23 '14 at 10:19 PM

Your explanation about “what is present at the output pin” makes sense with my observations. If I understand it right, the output pin of the “Select” node contains a copy of the data from the variable (array or not) but not the variable itself.

I realized just now that the problem I’m reporting here would also apply to any node that has an array as its output pin and that in many cases (or all of them except the “Select” node?) it would not make sense to allow modifications to it using the “Set Array Elem” node.

Then maybe the bug is that the “Target Array” pin of the “Set Array Elem” node should not be allowed to be plugged anywhere else than directly into a variable?

Once again, thank you for your time and have a nice day.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Howdy Grumyz,

Thank you for all your help with this issue. I have spoken to a couple other Developers and this is the correct behavior of of the 'Select' node. It is designed to pass the array contents, not the array variable. If any other information is needed, please feel free to let me know.

Thanks and have a great day!

more ▼

answered Jul 25 '14 at 07:46 PM

avatar image

[Epic] Gribbs ♦♦ STAFF
11.8k 292 14 77

avatar image Grayve Rose May 12 '15 at 08:09 PM

I ran into this issue today as well. I have a whole bunch of selects with arrays, but I guess the way Ive been using them up till this point its been fine. Thats good to know though

avatar image Raptagon Studios Oct 23 '18 at 08:43 PM

It is designed to pass the array contents, not the array variable. If any other information is needed, please feel free to let me know.

That doesn't make any sense, since you can't get any of the contents without the array handle...

I also need to be able to select which array I get from...

I thought it would work to make a pure function and use a switch on enum to grab the correct array, but that did not work either. I have to check which array to use a lot, so it's going to be a pain to hard code it in there every time I need to figure out which array to use...

avatar image SomeDude12 Mar 17 '18 at 07:53 PM

I am getting this error (once i connect "Set array of....References" var and press compile)in 4.18.3. However note that nothing is visible in the blueprint editor.

If the intended function of the select node is what Gribbs described the please add some sort of warning cause i saw some REALLY odd behavior during game play.

Also once i tried to "Launch" the game the first time it crashed during compiling and the second one it was as if not the entire code was compiled.... Same was in the "Editor" while playing. Parts of code didn't execute (i was stepping through the code and even if more blueprints where still down the line it simply returned before executing. Also i breakpoints that should been called weren't) . Furthermore note that the location "File:D:\blahblah...." doesn't exist in my computer. I have nothing related to the engine there. It's an empty disk.

alt text alt text *the cropped line by the screenshot is "LogOutputDevice: Error: Ensure condition failed: DestinationExpression->AssociatedVarProperty [File:D:\Build\++UE4+Release-4.18+Compile\Sync\Engine\Source\Editor\KismetCompiler\Private\KismetCompilerVMBackend.cpp] [Line: 1363] "

screenshot-16.png (216.9 kB)
screenshot-17.png (149.9 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question