C++ Immediate Problems with setting up a camera for a pawn



I’ve been learning blueprints a little bit now and I decided, great Idea, How about I learn C++ for unreal engine. And I’ve just been punched in the face, I watch one video from two years ago and now suddenly you cant add a camera in this way. I followed the video and thought this is easy, then bam I place the pawn in the world and there aint no camera component attached to it, I cant even go any further, brick walled from entering c++. I looked up how to add camera to pawn and the most I found was some things by epic games about camera spring arm components. But i Literally dont care can someone please tell me how I simply add the camera component to a pawn I know its stupid but I genuinley am perplexed at how this could hace changed.

hey @God_Ozai

To create components in an actor using C++, you first need to create a root component, and attach all your components to it.
This is what it should look like in your constructor:

there is no need to create the RootComponent variable, it is already in the standard pawn class, it is a link and is empty by default. We need to create a scene component and write it to the RootComponent variable.

components in unreal engine, with the exception of root components, cannot exist without an attachment to another component, therefore they must always be attached to something

Thanks