I would like to be able to create a Blueprint or DataTable (specifically, a DataTable in my current situation) with a UPROPERTY that can be used to reference an actor that has been placed in a level.
Normally, this would work by doing:
UPROPERTY(EditAnywhere) AActor* Actor;
except it doesn’t. The reason for this is that actors placed in levels don’t actually seem to ‘‘exist’’ yet until the level is loaded, which is obviously not the case yet at Editor-time (when editing the DataTable). I’ve done some googling around, and ran into threads where people claim that there’s something wrong with my design if I want to do this, like Actor-Pointer-UPROPERTY - C++ Gameplay Programming - Unreal Engine Forums
I don’t really believe there’s something wrong with my design in this case though. Basically, what I want to be able to do is the following. I want to be able to put an invisible marker actor in a level somewhere, for example to mark an important location where AI should patrol. I would like to be able to reference this marker in a DataTable, which contains data about what AI should do, and then be able to assign this DataTable to a Character or Behavior Tree for processing.
So, I have come up with some sort of workaround that should work, but is kinda ugly (hence, a workaround). The idea is to assign an FName to actors that I want to be able to reference, and have those actors reference themselves in a map using that FName in a BeginPlay() event. Then, the DataTable can simply use an FName UPROPERTY() to reference the actors.
I am mostly posting this because I am wondering if there are any obvious better solutions that I am missing?