How to Reference Camera Actor in a Blueprint

I have a user interface blueprint that I am creating to allow the player to open it up by hovering over a button to bring up a list of buttons, and each button connects to a camera actor. However, I cannot seem to get the camera as a variable in the UI blueprint. Only the level blueprint.

Should I even attempt to control the cameras with a separate blueprint or is it better to use the level blueprint and work from there? I just need an interface to control them but I can’t get the reference to the camera actors where I want them.

Getting the cameras in the level will only work for those specific cameras and if you change the level your variable is gone.

You can get your cameras (and change them) in your UI blueprint like this:

Note that I’m getting all cameras when the UI is constructed which means the cameras have to already be there and I don’t update it at any point sou you might want to change that depending on weather your cameras will be added or removed.

1 Like

I see, now since I want to be able to click a button that activates each camera, I am assuming I need a variable reference for each one? I want to switch them with widget buttons and be able to exit them. The cameras will already be spawned in and will never be removed.

I see that I did start putting this together but the problem I ran into was setting up the “All Cameras” array variable. I’m not sure how to put the cameras inside of it.

Get all Actors of Class should do that for you.

Is the array empty? Is it not working?

When I try to drag the cameras from the level into the array variable, it doesn’t add them.

This is what I have. I tried to add them in the array at the bottom under “Default Value”

No need to add them, mate.

This node will do all the work for you:

It will comb through the whole level and will return all actors descendant of that class. (in this case “Camera Actor”)
Unless you are using some strange cameras. But you are using “Camera Actors” for your cameras right?

I am using Camera Actors and it wound up working when I added the other integer nodes.

Glad you did.

Cheers, mate and happy coding!

1 Like