PointLight array Editable Anywhere can't hold references

Hello everyone,
I am trying to create a light switch that holds the reference to all the lights controlled by it, and when activated, the lights switch on/off.
My problem is that i can’t get the editor to reference to the point lights in my scene.
Here is my code:

UPROPERTY(EditAnywhere)
TArray<APointLight*> LightToSwitch;

What I get in my component:

And when I click to any of the point lights in my scene, the array element stays to “None”.

What am I doing wrong?

Thank’s :slight_smile:

Are you using sublevels? If yes make sure that the point light and the light switch are both placed inside of the same sublevel.
This is at least where i know this problem from.

Hello BlackCryptix,

This solved my issue! Thank you!

Have a nice day :slight_smile:

1 Like

You can have them be in different sublevels if you want, but you would have to use an array of soft object pointers.

TArray<TSoftObjectPtr<APointLight>> LightToSwitch{}; 
1 Like