Non-empty array returns length of zero?
I have encountered a weird issue with a function of mine that actually used to work before I upgraded to 4.19.2.
The part of the function of interest should get all instances of an actor array in the world. For the test, I only placed one instance in the scene. However, even though the array returns the one and only instance (instance zero), when I get the length, it finds that the length is zero, altough it should be one. How can this be? Even stranger is that appearantly zero minus one results in zero (??) and then then when zero gets plugged in into a getter from this array returns none (although instance zero should be there).
Please checkout the screenshot attached.
I am not sure if it is related, but another change in the version of the engine is that somehow I can't use the "get a reference" when I pulled from the array. Only get a copy is found. If I turn off context-senstive I can force to put in "get a reference" but then it is immediately converted into a "return a temporary copy". I am not sure if this is the cause, as in order to find the right instance a copy should suffice.
Many thanks for a hint.
asked Oct 10 '18 at 03:14 PM in Blueprint Scripting
I got it. So I managed to fix it by reparenting my blueprint actor to "actor". Previously it was a child of "target point".
It feels like a bug to me considering the fact that targetpoint (an engine class) belongs to the class actor (which is kind of obvious because you can place it in the world). But while in 4.16 this was no problem (and the same function worked there), here (4.19) the elements of the array did not seem to be valid.
My blueprint actor "spawn point" was created by placing a target point into the world and "clicking add blueprint / script".
So in case you experience something like this in your project where you cannot get instances of an array (even though they seem to be present in the array), then just checkout your blueprint or c++ class and try reparenting it.
answered Oct 12 '18 at 01:31 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here