Hello.
Is there any way to create the blueprint that contains data and simple methods to access it to use mostly like a structure?
Something like C++ structure with member functions …but without C++.
Thank you.
Hello.
Is there any way to create the blueprint that contains data and simple methods to access it to use mostly like a structure?
Something like C++ structure with member functions …but without C++.
Thank you.
Or even created with C++ but exposed to blueprint.
The goal I’m trying to achieve is using custom Set/Get methods on the structure from inside the blueprints.
Try an interface. You tell the Interface what Functions are attributed to it, then when you create a blueprint it can Implement that interface, but you’ll have to implement the functionality yourself.
I was hoping to use member functions in a pair with interface to implement some kind of multiple inheritance.
For example:
I have probably found the way to do it creating structures in c++, but I need to check this out and I can’t do it now =( So I’ll comment on this later.
p.s. And I know that I can achieve the same mechanics with nested inheritance but then I still need to implement get/set logic more than once.
Update: It doesn’t compile because “USTRUCTs cannot contain UFUNCTIONs”.
And this is kind of strange.
USTRUCT(Blueprintable)
struct FCharacterStats
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
int32 vitality;
FCharacterStats();
void SetVit(const int32 NewValue);
};
This compiles fine until I add UFUNCTION(BlueprintCallable, Category=“Stats”) for the SetVit method.
The only workaround I’m thinking about now is creation of blueprint library with set/get functions for each of the structures I have.
I’ve found this:
http://thehumgame.com/tutorials-from-the-hum-1-using-c-uobjects-as-data-objects-unreal-engine-4/
But there seems to be no way to call ObjectInitializer from inside the blueprint. So back to code or static blueprint libraries.