I found this bug when I’m creating Character Name Array in my Unit BP. I created an Name Array (Text Array) and manually added 3 Names (test 1, 2, 3), and just print string when beginplay to test, when I get the 1st value, it shows properly “Test 1” , but when I change the index to 1 or 2, I believe it should show the 2nd and 3rd value from my Text Array, but it doesn’t print anything. so I tried to get length of the array, now it shows properly “3” as there are 3 values in my array. Why it doesn’t show the value of other index but can only show the 1st one?
It works flawlessly for me. Can you delete your unit in your level and place it again? It is possible that your object instance in the level no longer holds your default values set in your blueprint.
It prints also to output log, so open that window and see what it was printed there. Print to screen just scrolls up quite fast, in output log it all stays. Also print once, not multiple times. And no idea why event begin play is triggered multiple times in your code.
I’ve tested this again, I have a Unit_Base BP and a player unit BP which is a child of the Unit_Base, I have this Name Array under Unit_Base, so when I access this variable inside the Child BP, it can only show the first value, but it fails to show all other values, this “get array value” only works with the parent (Unit_Base) BP, all other default values don’t pass to child. Was it supposed to work like this , or did I misunderstand it? Thanks
Are you sure that PARENT and CHILD begin play are executed, and in correct order?
Also really print to output log, you will see order of execution there.
This is the Array I created under BP_Unit_Base, if I place this BASE character in the level, Event Begin play will pick a random name from the array and print, it works fine.
but if I only place the Child Unit in the level, for example, BP_Unit_Player_Warrior (child of BP_Unit_Base), it will not print the names from Array. seems print didn’t get triggered. The Print String is from Unit_Base BP and hooked up to Event Begin. no other edits inside the child BP, I thought it would call the same print as from the Parent BP.
If you want your parent’s BeginPlay to execute from the child BP you have to add a call to the parent function:
(this should be default when you create the child unless you delete it)
…valid for all events.
Cal Parent function was added. I still can’t figure out why the child BP doesn’t take Parent variable values as default.
To sort it out (what causes missing values), you need to start hunt foe elephant (your bug) in africa:
Create array (by adding strings to it), then pass that.
This is to see if error happens when you set values in details panel or when you pass those values.
So you can eliminate possibility of some bug in details panel.
Also code (what you see in blueprints), is not code that runs (well code is same, but actual actor/object is not), in game copy of that code/actor is running.
So add breakpoints, and inspect values in runtime.
And add to print: get self > get name of actor > print it (format text is nice to format output) , then print value of array
And look into output window for results, not on screen.
Tried everything and I figured out how to solve the problem. originally I wanted a Name array under Character Base BP, but that Array’s values don’t pass to children, the array value can only be extracted when Character Base is placed in the level, so I created a widget blueprint, which attaches the parent character, put the name array inside the widget, and call random name from it at Begin play, then children character would be able to show the random names from the name Array widget. now I understand that Array values from Parent don’t pass to children, the children recognize number of items in the array, but can only show the first item, when adding new items to the array from children, it will add them to the last, without showing everything in between.