Can I access actors in world from plugin?

I’m trying to make plugin for my game.
I’ve created toolbar button which shows property window (created by FPropertyEditorModule). That property window is connected to my custom object for level editing as follow.

UCLASS(config=Game)
class UTileBEditorObject : public UObject {
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, Category = "TestCategory")
	float testFloat;

	UPROPERTY(EditAnywhere, Transient, Category = "TestCategory")
	class ATileController* targetTileController;

    //for test
	UPROPERTY(EditAnywhere, Category = "TestCategory")
	class AActor* targetActor;

};

The window shows properties correctly as screenshot but I can’t choose any actors or tilecontrollers in my level with warning:

LogProperty:Warning: Illegal TEXT reference to a private object in external package (BP_TileController_C /Game/Maps/TestMap.TestMap:PersistentLevel.BP_TileController_4) from referencer (TileBlockEditorObject /Engine/Transient.TileBlockEditorObject_0).  Import failed...

32995-1111.png

I found something in PropertyBaseObject.cpp:388~396, target, actors in the level, should be RF_Public or Outermost() is the same each other to avoid this warning and get correct reference of actors in my plugin.

How can I fix this problem?

Hey Cordis,

I’m struggling with getting this to work. Have you possibly found an answer to your question already? :slight_smile: I can’t find anything on the web about this issue.

Thanks in advance!

You cannot have references to level actors from outside of the level.
If you are ok with them being invalid when the level isn’t loaded, turn your actor pointers into TLazyObjectPtr

TLazyObjectPtr<ATileController> targetTileController;