Set and Get Object reference

There’s probably a really simple solution for this I’m missing but maybe not.

I’ve set up a launch pad in C++ and blueprint. What I want to do is have a variable on it that I can select where the player lands after they have been launched so I have possibly have multiple launch pads in the level. I can’t set the variable though.

If I use:

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Variables")
TSubclassOf<AActor> LandingTarget;

I can’t choose a specific object but if i go with:

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Variables")
AStaticMeshActor* LandingMeshTarget;

(or AActor*) then I get a warning message “Illegal TEXT reference to a private object in external package (StaticMeshActor /Game/Maps/FirstPersonExampleMap.FirstPersonExampleMap:PersistentLevel.Cube_5) from referencer (BP_LaunchPad_C /Engine/Transient.World_20:PersistentLevel.BP_LaunchPad_C_9). Import failed.” and the object won’t be selected.

Any ideas what I’m doing wrong?

Try changing

 EditDefaultsOnly

to

EditAnywhere

TSubclassOf expects a class reference (not an instance of a class) so it doesn’t make much sense to me to use that.

As for using AStaticMeshActor* reference, I’d guess the issue is that the engine can’t figure out how to get a reference to the selected object instantiated by the level. Have you tried giving each launch pad its own cube (declared & spawned in/via the launch pad class) that it can use and you move that around to determine where the player should land?