Follow up of - How to Change cameras by UMG button? Referencing a camera from main level to UMG?

Hi everyone,

I was following this thread - How to Change cameras by UMG button? - Blueprint - Epic Developer Community Forums However I can’t get a vital piece of it working - How can i link the camera I have in my main level with my UMG Widget button?

I have created a test BP and it works however when I click on the button it just floats to a point in the middle of my level (instead of to the camera I have already set up) - so How do i set my variable in the UMG to reference the camera in my main level?

Anyone? :slight_smile:

The way I typically grab camera instances from a level is inside of the level blueprint. If you click on the camera in your level such that its selected and then go into your level blueprint and right click anywhere in the event graph you can see at the top there is a option to create a reference to the selected object in the level. From this you can save this to a variable inside of your game mode, game state, game instance, anywhere that suits your needs the best. You can then access this variable in UMG by again just sending a get request for the variable stored on your game mode, game state, game instance etc.


  1. Create a camera in the level
  2. Select the camera and then open up the level blueprint and right click in the graph and select the option to create a reference to that selected object.
  3. Set the reference you created in step 2 to a variable stored in another class such as game mode
  4. In UMG you can access this variable using the ‘Get Game Mode’ node, then casting to your Game Mode class, and finally using a ‘Get’ node targetted on your casted game mode class for the variable you saved in step 3.

Hopefully this helped :slight_smile:

Thank you Mellark for taking the time to respond, if you could help clarify steps 3 & 4 I would very much appreciate it!

I have created the camera actor reference in one of my levels, so how do i store it in another class (such as game mode?) apologies for the basic questions but I think I am doing some complicated things with not so great personal knowledge of unreal right now…

Ok never mind, I found this How to Change Cameras by UMG button? - UI - Epic Developer Community Forums thread which explains it perfectly! thanks for help tho!

Awesome! Glad I could help in some way


Ok I have a new problem but thought it was worth doing in this thread instead of a new…I basically have my camera set up in my character using a spring arm. I can now click my UMG button and it will blend camera to one of my static cameras. I have then got a UMG Widget to pop up once I have blended to static camera with the option to go “back”… so this is my problem, how do I reference the spring arm camera at it’s default position (upon scene start) using the camera blend?

Below is my set up for blending camera to static camera and the other is the start of me “trying” to reference the spring arm camera in my character BP.

Well first I don’t think you want to reference the spring arm. The spring arm acts as a component that more or less binds the camera at a certain distance from another actor component. What you actually want to do here is reference the camera attached to the spring arm. I only have a few minutes so I can’t test this out for you, but I can give you a route which I would explore. When you use the ‘Get Player Controller’ node you can plug that into a node called ‘Get Controlled Pawn.’ Using this I imagine you would be able to grab a reference to the camera on that pawn. Just be careful if you made a custom pawn because you would need to ensure you are properly casting to your custom pawn.

A generalized node flow might look like the following:
‘Get Player Controller’ -> ‘Get Controlled Pawn’ -> (optional)‘Cast to X pawn’ -> ‘Get camera component’ -> ‘Set View Target With Blend’

If you can’t find a way to directly access the camera component using a node (I can’t remember since its been a while), you could also create a variable in the pawn/character class which would save a reference to the camera component on ‘Event BeginPlay’.

Hopefully this helps!

I do the other way. You create an array of camera in game mode or player controller . That view target relate to current view or camera you can make it change by set view target to any camera you want. So in your level you can put all camera into array and create widget to control it by index or name. I use interface to connect with native actor or delegate to bind event to widget action.

Brilliant! you were right I just needed the pawn controller! thanks mate :slight_smile:

I believe that’s overkill for his needs. At this point he only has two cameras. And although, yes, that method would work for many cameras I don’t think it’s a great idea to mix static level cameras with character cameras etc. in the same array. You could create separate arrays for level cameras and another for character cameras, but that’s more or less what he’s already doing. As well, I don’t think saving character cameras into an array is a good idea either as there’s really no reason to. In my opinion, if its a multiplayer game, it’s smarter to just save player controllers to your game mode and then you can access any of the players cameras at any point you need using the method I described.

  • Saves on memory by not declaring an additional array
  • Reduces confusion. Ie. How do you efficiently associate cameras to the applicable character in an array.

I have grown to 5 static cameras in my main level, there is a 6th that is the player controller with a camera attached to Arm… The Aim is to be able to orbit around a main model (limited by choice) and then click on points that “zoom” you closer to the key areas and remove the control or moment, hopefully adding info to these closer bits…

Altho I am now having “another” problem… I thought I had finally cracked everything so all I needed to do was replicate my “hotshots” and change the names / variables accordingly, and it worked for the second, but for some reason I can’t get 3, 4 and 5!

In my main level BP i have this which makes the hot spot actors face the main armed camera (this works fine!)

And this for blending with each static cam

This is just showing the names of the cameras in the Game mode BP

and here is a typical “hotspot” actor BP I have set up, there are several named “city” “eat” “shop” etc…

and a view of the hotspot:

So why am i struggling to get a “hit” on any of the last 3 spots? I have got them to follow the camera that all works but I get zero hits! I have attached a string previously to see if it was just a visual problem but i wasn’t getting any hits from that either… maybe I have been working on this too long today! if you can spot the problem or if you think I could have done any of this a better way please let me know as I am a very basic / new user!

Mmmm Never mind, apparently all I needed to do was delete the actors and drop them in again and they worked! must be a “quirk” lol…

If anyone looking how change view back to First Person Camera, You should change your variable type in Game mode from Camera Actor to First Person Character

And next go to level blueprint and now You can attached it to your camera view like in this solution How to Change Cameras by UMG button? - UI - Unreal Engine Forums

And finally You can create action for your button

Crazy I’m looking to do the exact thing - I’m stuck on Level BP attach cameras to GameMode - The pictures are gone. Any ideas?