Setting up default Pawn to use in my game mode

Hi there,

i’m just starting to use UE4, so i’m using the documentation tutorials to get started.

Right now, i set the default game mode to use my “MyPongGameMode”, and this works because i print some debug stuff on screen when StartPlay(); gets called.

After that i created a new character class, “MyPongCharacter”, added some debug stuff in BeginPlay(); and set it as default pawn in my “MyPongGameMode” but i can’t see the debug message.

So it’s seems like my character class isn’t used at all, but i did exactly what is written in the documentation…

if somebody could help, thanks in advance.

Did you set DefaultPawnClass correctly?

i set DefaultPawnClass = AMyPongCharacter::StaticClass();

in the GameMode constructor

So you are using C++. Is your game networked? What is your debug code? The GameMode only exists on the server, so depending on your setup your character is spawned on the server and debug code may in fact be running but not in a way visible to the client.

i’m using c++ indeed, no networking nothing really special, just my gamemode and my character thats all i have atm

EDIT: i wanted things to stay relatively simple :slight_smile:

It appears you are doing everything right in your GameMode. If there are any GetDefaultPawnClass() getters, you may need to override them, but it is unlikely.
It sounds like all you need to do is set your MyPongGameMode to the default game mode on your map and, depending on how you want things, In your DefaultEngine.ini. Both of these things can be achieved in editor rather simply. To edite DefaultEngine.ini through a visual interface go to Edit->ProjectSettings then under Project go to Maps & Modes then set Default Game Mode. Under the hood this will write to your DefaultEngine.ini just as though you input the values by hand.

Changing the map value is similar in that it can be done from editor but different and deals with overriding the AWorldSettings class values which can be different for every map in your project. If they are not immediately accessible under your World Outliner, double click your World in World Outliner to bring them up. it should look like this.

I hope this helps!
-Spiris

Do you have a PlayerStart actor in your level?

Yes i do have the default PlayerStart actor

Hi,

thanks for the answer Spiris but this is my project settings at the moment :

And this is my World settings selected in the world outliner :

The images you linked are not working.

gonna fix

edit : images are fixed

Problem solved