Variable Values for C++ and Blueprint
I understand the order of event for the game is C++ Constructor -> BP Constructor then C++ BeginPlay() -> BP BeginPlay().
Currently, I have variables in C++ which are marked EditDefaultsOnly and exposed to BP. If I set those values in BP but try and access them in the C++ constructor, it returns the initial value set in C++ (such as nullptr) NOT what was set in BP.
Right now I am trying to create / use UDataTable but the row name is set in BP (initialized in C++ as " ") and it never finds the row (UE_LOG shows it trying to find the row with ID " " ).
When are the values set in BP readable in C++?
As you mentioned, the C++ constructor runs before blueprint construction. If you're setting something inside the blueprint, the C++ constructor won't know what is being set. You can try the PostEditChangedProperty() function as this is called when an actor is created / updated in the editor. Your best bet for ensuring that what is set in the blueprint is accessible in C++ would be to access the value in the C++ BeingPlay() function.
answered Mar 30 '17 at 03:29 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here