The problem here is that your struct is using UObject as AfflictionClass, while the method GetEffect takes BPAfflictionClass and not UObject.
Easiest way to explain it is “an apple is a fruit, but a fruit is not an apple”, an AfflictionClass can be a UObject, but not the other way around. You should create a new c++ class “UAfflicationClass” and make that blueprint BPAfflicationClass inherit from it (by setting the parent class on the editor panel). In your c++ struct instead of using UObject for the property you use UAfflicationClass. Update the variables / parameters to accept that c++ class as input.
Thanks for the reply Roy! It’s making more sense on what was going wrong, I’m a step closer (I think) but the last bit both in blueprints and my mind isn’t connecting.
Which is beginning to make sense. Knowing that C++ can’t communicate with blueprints, having this file that they both can reference is a dot connected. But the I’m really unsure what I’m missing to get this to connect.
Here’s the new C++ parent class.
#pragma once
#include "CoreMinimal.h"
#include "AfflictionLink.generated.h"
/**
*
*/
UCLASS( Blueprintable)
class XXX_API UAfflictionLink : public UObject
{
GENERATED_BODY()
};
What remains is that the data type of parameter Affliction on the method GetAffliction should be updated to be the c++ class you made, else you have the same problem as I described with the UObject.
Dang it. I thought I understood. But I still can’t seem to get the data from the struct. In my head I thought it was pulling from the parent struct and it built the connections from there. but getting the functions out of the original BP is still an issue. I can call them from BP itself, but when I used the LINK it doesn’t have them. I assume it’s because I don’t have them defined in my AfflictionLink.h, but my worry is that if I put them in the link, the names will show up and connect just fine but the functionality won’t be there.
But I’m wary that this is best practice?
Thanks for the help, I should be done with construction in the next few days and will will remember to post back!
If you wish to call any of the methods, or access data through that c++ class then you must first port what you implemented in Blueprint to c++. This is the correct way to do it though, just port it all one by one.
I think you are also mixing up something else here. You are accessing data from the class default on that image. I think you might want to access data from an object instance instead? If you don’t know the difference between a class and an instance it is important to look for a tutorial about that asap.
Thanks so much for support Roy, I’ll go brush up on object instancing. Converting a project to C++ from BP has been an immense learning experience. I appreciate your help!