0

I'm a newcomer for unreal engine 4. I'm trying to bind a swith object with a door object, so that I can trigger swith to open the door.The switch class is written by c++ code and the door class is written by blueprint. I added a property in Switch.h for adding the door object through blue print. The code is as below:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mesh")
bool IsTriggered;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Mesh")
AActor* TargetActor;

And I can see this property in blueprint: enter image description here

However, After I select the actor from the dropdown list, the value of Target Actor is still None. I'm frustrated by this. It will be very appreciate if someone can help me on this? Thanks a lot!

cartman
  • 580
  • 2
  • 5
  • 19

1 Answers1

0

Try with to pick an actor from your content folder, to be spawned for example

TSubclassOf<AActor> TargetActor;

instead of

AActor* TargetActor;

Then you can pick any actor or derived.

or use TSoftObjectPtr to pick an actor from the level

TSoftObjectPtr<AActor> TargetActor;
Gustavo Otero
  • 91
  • 2
  • 10