Greetings folks,
I’ve run into an issue while trying to use C++ in tandem with Blueprints and hoped someone could provide some insight on what I may be doing wrong. I’m new to Unreal and game development in general, but I am very excited to learn.
I’ve recreated the issue on some test objects to avoid any confusion and it is as follows:
I’ve inherited from an ActorComponent for one class and created a function that takes a pointer as a parameter to another class derived from UObject:
Then, I have created a child blueprint class of the class derived from UObject and assigned some default values to this child class:
From there I created an actor and added the ActorComponent previously mentioned. In BeginPlay of the actor, I construct an instance of my Blueprint Child Class and pass this into the BlueprintCallable C++ function from the ActorComponent:
And with this, this is the output I am given:
As can be seen in the top left of the play window, the Blueprint print function outputs the correct data, but the C++ output shows the values being defaulted to 0.0.
With this, I thought it might be passing by value, so I’ve attempted to pass by ref with
void TestFunction(UPARAM(ref) UTestDataObject*& data);
, but that still gives the same results.
The version of the engine is the most current at the time, 5.1.0.
I feel as if there is a piece that I am missing and would appreciate any guidance that can be offered. I hope my explanation was clear and if you have questions, please feel free to ask.