In my game, you can interact (I’m using component overlap to enable input + enhanced input system) with child BPs in the world to collect items, and those items should be added to their parent array, but it isn’t working.
The children “BP_Sigils_Child” (there’s 3 manually placed in the lvl) have a Name variable that’s editable and transfers it to a parent variable, nothing fancy.
However, clicking the child BPs returns their names, but always with zero index. This is me clicking on one BP after the other and getting the same result.
I’ve tried using ADD UNIQUE, doesn’t work. INSERT doesn’t even show any result. I’m not setting the array anywhere else, and it’s empty by default, since the plan is to add items at runtime. Both BPs start with tick enabled.
I don’t know if it’s a bug or just I’m not seeing what’s wrong : /
I was transferring the array to my Game Mode for testing, just to see if my parent BP was the problem. The event below is being called on begin play by a Set Timer by Function Name node.
Try making other variable arrays that adding to the same function and print the index.(some Name, String, Int array for measurement.)
If other array type’s index prints fine(not 0), you may have to clean/rebuild your project(delete Binaries folder to regenerate blueprint codes).
And if other array type’s index is also 0, then I donno
I’ve created another array and deleted the project folders, got the same result. I was testing sending the array content to a Game Mode array, but yeah, nothing changed.
The only thing I fixed was deleting the Do Once node and adding a branch check in the interaction code, and now I can click LMB multiple times and the items stops being added to the array. But the index doesn’t change, it keeps the name at 0.
Just something really fast- a big piece of information that I’m not seeing.
When you GET that Array, are you getting a REF or a COPY?
Ref(erence) will get you the actual, original, permanently changeable array- I’m seeing a lot of Copy behavior- not saving permanently etc. Copy is great for when you need a starting off point over and over for math functions and such.
Sometimes the biggest problems are due to the smallest details, you know?
Sometimes the biggest problems are due to the smallest details, you know?
Oh don’t we know that hahaha
Well, the only place that I was using GET was to read the array, and it was indeed getting a copy not a ref. I’ve replaced the node, but I’m getting the same result.
Does adding to arrays have any secrets or settings that I’m not doing beforehand, or any extra configuration regarding the relationship between parent/child? Should I call a priest to exorcize my project?
I think this is the problem. Each child has its own array of names and the master blueprint doesn’t work like you intend it to. To use a master blueprint you would need to drag it into the level or something and create a direct reference to it so that you could call an event to it, otherwise you are just interacting with 3 different master blueprints.
Yeah, that seems to be the issue. I’ve given up using the Name variable, and I’m now trying to find alternatives for what I’m trying to do.
Thanks for the help everyone, if I ever find a solution, I’ll post here