Hi,
So obviously I am being dumb and missing something here.
I have a datable with 2 items in, (as a test, there will be several more in the end) I transfer those items to an Array. (so that I can pick and sort the items I want) I have printed a string of the array length and there are 2 items in it. I then loop through that array with a for each loop and say Spawn Actor. ( have attached a print string to the loop and it says 0, 1 so only has 2 items in it)
So looking at that I should have spawned 2 actors, right!? However in another piece of code I use the function get all actors of class and ask it to spawn a widget to be added to a uniform grid. When the game loads there are 3 items in my array 3!!! and only 2 of them have the data from the data table…the other is an empty blank widget.
So what am I missing?..I am no doubt being dumb somewhere but I have printed strings and tested all my arrays, they only have 2 items so should only create 2 actors.
I did some further testing where I had 0 items in my array and it still created an actor, but still never gave it any data. So it seems like the “get all actors” function is returning a phantom creation.
I ran some another test where I didn’t do a for each loop and used a loop, and set the range from 1-2 trying to avoid the erroneous 0 spot in the array, however instead of the expected 2 items I got 1 blank item and 1 full. I then just did get point 2 in the array and it returned a blank item.
When I run the thing, in the world out line there are 3 actors…I just don’t understand where the third actor is coming from? I am using a “for each loop” on an array with 2 items in it. More bizarre than that though…it doesn’t complete the code…so I have 1 blank and 2 filled widgets…so it is creating an actor and then stopping without running the entire line of code…and then running through 2 times and creating the code correctly.
I have never seen anything like it and it is blowing my mind! I thought maybe I am creating an actor in another line of code somewhere…but that would not be creating a widget, so it wouldn’t appear on the screen.
My mind is boggled after looking at this 1 small thing for 2 days…help me internet, you are my only hope!
Thanks