How can I get a reference to default camera in a new "blank" project with no starter content?

Hello,

When I create a new blank project with no starter content, the project comes with 5 actors;

  • atmospheric fog
  • sky sphere
  • light source
  • player start
  • default floor

When I start playing the level, I can see that a number of actors are added automatically, such as camera, default pawn, game mode etc. Since these actors are only available during gameplay, there is no way to create a visual reference node for these actors by dragging & dropping them to the blueprint editor.

Question: How can I get a reference to default camera in blueprints? - (currently working on a very minimalist FPS, so I need to trace a line from the camera)

Note: I’ve already tried getting a reference to camera by getting all actors in the scene and searching by name. However, the name of the actors added on the fly keep on changing incrementally! So, searching by name seems to be unpredictable.

Kind Regards,

Hey Dynamo,

The default GameMode starts with a Default Pawn Class that has its own CameraActor. You can reference it with the Get Player Camera Manager node, which gives you access to its location and rotation, among other things. It might be worth your while to look into creating your own GameMode and assigning a custom Default Pawn Class and Player Controller Class to it, so you have more control during development.

There some documentation available about the GameMode and what it’s for here:

https://docs.unrealengine.com/latest/INT/Gameplay/Framework/GameMode/index.html

and some info on setting up a Controller and Pawn here:

Not all of that information would apply to you if you’re attempting to make something simple, but a simple GameMode + Default Pawn Class + Player Controller might save you a lot of work in your project.

Hope that helps!

Ben Halliday

Dear Ben,

Thank you very much for the quick and detailed reply.

Both links are great!
Now, I understand how it works under the hood…