Point Light Component Object Reference is not Compatible With Array of Point Light Object Reference

I already get all the point lights in the blueprint and integrated them as an array. When I’m trying to connect the array to an array variable named “Lights Array”, it reports the error of “Point Light Component Object Reference is not Compatible With Array of Point Light Object Reference” see screenshot below. How could I solve the problem?

The error is telling you that your array holds the type “Point Light”, while you’re trying to put a “Point Light Component” into it. Those two, although named similar, are not the same thing.

image

Change your array to hold the type “Point Light Component” instead of “Point Light”.

Thanks for the reply. However, if my blueprint in the further steps needs the array to be a “Point Light” rather than a “Point Light Component”, how do I convert the integrated array from point light component to point light? Thank you!

Ah it might be the other way around also, you might be making there an array of “Point Light” Actors, but trying to put it into an array of “Point Light Component”.

In either way it’s easy to get one from the other, since “Point Light” is just an Actor that contains “Point Light Component”.

To get the “Point Light Component” of a “Point Light” actor you can call PointLight → Get PointLightComponent:
image

To get the “Point Light” actor which owns a “Point Light Component”, you can call PointLightComponent → GetOwner which you then cast to a “Point Light” actor:
image

Thanks for the advice. However, when I’m dealing with multiple point lights, I get the error as shown below. How should I connect the Exec pin from “Event Beginplay” to multiple nodes?

You can just connect it from BeginPlay node to the first cast, then to the second cast, then back to the Set node.
Or you should be able to right click the cast nodes to turn them into Pure Cast nodes, then they don’t need the exec pin.

1 Like