Cast Would Always Fail

Hey there! I’m working on a small video game and I want to have multiple cameras throughout the level as my main menu. Everything works fine except that I can’t switch between the cameras. The idea:

Clicking “Settings” disables camera 1 and enables camera 2, and vice versa.

Here is how the blueprint looks like. It says the cast to my pawn cameras placed in the world would always fail (From UI to Pawn Cameras). I have no idea what to do.

It fails because you tell the editor this widget is the camera. That’s what a cast is (among other things), it’s a test.

  • where are the cameras? Are they actors sitting in the level?
  • where and how is this widget created?
  1. They’re pawns located in the level.
  2. The widget is created in the level blueprint on Event BeginPlay
1 Like
  • reference the cameras in the LB:

  • in the LB:


You can repeat it for the other buttons. It can also be automated a bit but if it’s just 4 cameras, it may not be worth the fuss. If the buttons are sitting in a panel, like a vertical box, all of them could be bound in a single loop instead.

Alternatively:

  • create an array of cameras in the widget and expose it:

  • you can then assign it:

Thank you for your time and effort!