I fought and fought but now I think I’m stuck. Hope you can give me a hint.
The basic structure that I’m working on:
A - There’s a C++ ‘MyController’ class. It also includes an Array of custom MyStructs.
B - Then there’s a C++ MyInterface which I use to provide functionality to interact with the MyController class.
C - I create a MyBlueprint based on MyActor which includes MyInterface.
D - The MyInterface functions should be accessible via blueprint. So I’m using BlueprintNativeEvent and BlueprintCallable UFunctions.
Now it gets difficult: Certain events need to access data from a certain MyStruct.
But I cannot find out how blueprint handles pointers at all…
I want to use a pointer to MyStruct to make sure it’s always the most current version.
First it seemed easy to do that. But everything I try gives me compiler errors.
I tried it using function arguments based on what I found in Actor.h:
/** Event when an actor no longer overlaps another actor, and they have separated. */ UFUNCTION(BlueprintImplementableEvent, meta=(FriendlyName = "ActorEndOverlap"), Category="Collision") virtual void ReceiveActorEndOverlap(class AActor* OtherActor); // I thought I'd just do the same thing. /** Event when an actor no longer overlaps another actor, and they have separated. */ UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "On My Event"), Category = "MyStuff") void OnMyEvent(struct MyStruct* Parameter1); // Compiler Error: Inappropriate '*' on variable of type 'MyStruct', cannot have an exposed pointer to this type (move it inside the CPP block).
What can I do to make it work? Or, after all, why doesn’t it work? …
I’m out of ideas. Thanks for helping.
EDIT - addition:
How can I use BlueprintImplementableEvent and BlueprintCallable in one interface?
Seems like a logic thing to do. But I keep getting this error:
Blueprint implementable interfaces cannot contain BlueprintCallable functions that are not BlueprintImplementableEvents. Use CannotImplementInterfaceInBlueprint on the interface if you wish to keep this function.
Alright. Then again I cannot use CannotImplementInterfaceInBlueprint as I want to use BlueprintImplementableEvent…
Is there another solution or do I have to split this up into two interfaces?! (That would be pretty ugly…)