How to Change cameras by UMG button?

I need help with how to change cameras by UMG button using Set View Target with Blend?

What’s your problem exactly?

You could do several things:

a) Your blueprint widget has a reference to the new camera so it calls directly Set View Target when its pressed
b) The blueprint widget calls an event dispatcher when the button is pressed and levelblueprint (or other actor) assigns this eventdispatcher to the code for Set View Target with Blend

for a) I will try to explain every step:

  • You must setup a blueprint of type Widget user interface. Then, add a variable (on graph tab) of type “Camera Actor”, make it public and expose it on creation if you want. Then assign the desired camera on widget creation.
  • Create the button on the designer tab
  • Add an OnClicked event to the desired button inside the designer tab. Now it will redirec to the graph where you simply plug the Set View Target with Blend using your variable camera as input

b) is similar, just do the call to the eventdispatcher and whenever you assign the code do the Set View With Blend

Hey thanks for the help but I’m still confused on where certain things go in which blueprint. I try what you said but still something not connecting. I think I’m messing up with the assign the camera on the widget creation.

Nevermind, I got it. Thanks for the help.

hi, how do you reference a camera to a camera actor variable in the umg graph?
i didnt get it

thanks for helping

You can’t as far as I’m aware the only way to reference scene objects is through the level blueprint. And at the moment you can’t cast to the level blueprint so there wouldn’t be anyway to acess the reference. (They are changing this in 4.9 version)

hi enigmaa, thanks you for the answer - that means solution a) from dredrok , isnt working in 4.8.3? or is there another way, using the camera actor variable?

well you couldn’t change it directly using a widget button until 4.9 when you can cast to the level blueprint. But you could set up the camera changing to happen in the level blueprint and set it up to change on a keyboard key or mouse button press. Or even when you click or mouse over something in the scene.

I have a set up like this for a character selection screen im working on. Basically i have 3 cameras in the level and 3 target actors. I have references to these 3 actors in the level blueprint. When i click on one of the actors the camera moves from the main camera and switches to the new camera facing the actor. When i click him again it zooms back out . This happens for each of the actors .

hey there,
i have the same problem. can anyone help here with some advice?

i want to control camera actors to UMG menu buttons.