Download

Setting Default Pawn In C++

Hi guys. I am new here and cannot figure out how to set default pawn in game mode with C++.
Another question is that it is really hard to find any information about c++ api. I am coming from Unity and you can find any information about c# api for Unity really easy and documentation is really good. But, it seems that it is almost impossible to get any information about c++ api… Now I am thinking how I can go far with this poor documentation. I do not know maybe it is my problem not being able to find information. Anyone can give a suggestion about this?

That one is pretty simple:


AAwesomeGameMode::AAwesomeGameMode()
{
	DefaultPawnClass = AAwesomeCharacter::StaticClass();
	PlayerControllerClass = AAwesomePlayerController::StaticClass();
        // etc.
}

That one is a lot harder. I don’t think it is a problem of finding information, many parts of the C++ API are simply not well documented.

If you’re trying to do stuff that is similar to one of the examples EPIC provides, then these examples are often a pretty good starting point to figure out entry points into the subsystem you want. The code itself is often quite readable (well, if you don’t try to look at stuff such as UObject where a lot of magic is going on :confused:) so once you know where to start, a combination of the available tutorials and documentation, and browsing through the code is often enough to figure out how to achieve what you’re after.

Personally I used to build the engine from source so that I could run in the “Debug Editor” configuration. This makes it easy to set breakpoints and step through the engine code in the debugger which is a pretty great way to understand what is really going on. Admittedly that’s not the fastest way to learn about individual features, but it has the advantage that once you’re familiar with the important parts of the engine source it becomes much quicker to debug problems in your game because it’s often easier to figure out a bug if you can trace what’s happening at the engine level.

Many Blueprint nodes also allow you to navigate to their C++ implementation so you can also look at Blueprint examples and transfer them to C++. (It might also be possible to use the Blueprint->C++ compiler to compile BP examples into C++ and look at the generated code to see how stuff works, but I’ve never tried this and the generated C++ code is probably different enough from code you would write by hand that this is not a viable approach.)

Yeah your way of learning the Engine seems pretty hard and probably a bit impossible for me at the moment since I am kinda noob. Maybe I should stick with Unity, I do not know. Actually I always want to learn Unreal Engine but when I try I relaize that their documentation sucks, I am really disappointed. I knew that there are not many tutorials for C++ but, I did not think the documentation is that poor.

Yeah, you are not alone in that. I have been searching to solve this and sadly i havent found my solution. Unreal would become way more indie friendly if they fixed their documentation

“Indie” doesn’t mean “-I don’t known the API”.
But Epic definitely won’t hold your hand like Unity or YoYo does.

Unreal has far better content examples to learn from IMO.

For C++ Programming, the code is the best documentation. API docs are useless anyway IMO. Most of us start learning by studying the code that already exists in the engine and the samples, then continue from there.

/\ That’s true.

For the first 5 months of my experience with Unreal Engine, I didn’t do anything but look at free demo projects from launcher and read source code (to understand why EpicGames do things the way they do)…
Sometimes I study software that I plan to use only 2 years after, no rush.

But many people hate that, majority want to learn on the go, this is why they love Unity (you can learn while working, because basically your work is all covered by tutorials) and stay away from CryEngine ^^

Heres the link to the api docs…cant say ive used it though so no idea how comprehensive it is.

for some good c++ tuts go through mr Loomans super tuts:

If you are coming from Unity background, you need to know that Unity has to give you documentation because they don’t give you source code of the application simply, where as epic does ! And the best way to learn game development is to go into the C++ project and examples Unreal gives and learn from them.

All the best.