Hey everyone, I am a student making my first game in Unreal, and I’ve run into a funny problem. My PC doesn’t get auto-possessed when my level begins. I have a custom game mode, which has been set to possess the pawn class I want, and I’ve also selected the right player controller. In my game world, I have a PlayerStart object and I’ve made sure the Play Settings are set to spawn the player at the Default Player Start. Yet, when I play my level, my character isn’t possessed, or even spawned in the scene for that matter. I have to manually hit F8 to spawn it, possess it and play. What could be the problem here? I’ve gone through tons of old forum posts but can’t seem to find a fix. Please help me out if you can. I can share more info with you if needed. Thanks a lot.
Did you set the gamemode with your gamemode, in the world settings or in the project settings? Did you set the right Default Pawn Class in the gamemode?
Yes, I did
Does your pawn and controller appear in the world outliner (during runtime)?
The PlayerController appears, yes, but my Pawn does not. A SpectatorPawn appears instead.
Make sure you are NOT running it in “Simulate”:
Ah right that helped! Thanks! I still have to click in the viewport to begin playing though. That’s normal right?
Yes, that’s normal.
I had a similar problem where the level was creating a new pawn oriented to the editor camera instead of auto possessing the pawn I had in the scene, even though I had this code in my pawn constructor:
AutoPossessPlayer = EAutoReceiveInput::Player0;
I found there is a checkbox in the Details of the Pawn instance that says “Auto Posses Player” and it was set to “Disabled”. I had to set it manually for the correct autopossessing to work. Still not sure why the code didn’t set it for me.
I’m experiencing this too. I placed it in the instantiation of my Player character. However, it does not work unless I set the checkbox in UnrealEngine GUI. Anyone have any ideas of why this is?
I’ve found that code changes don’t always get applied to Blueprints derived from the class after re-compiling. Sometimes if you close out of the editor and re-open it will get applied, but sometimes the only way to get the Blueprint to fully reflect the code is to delete the Blueprint and recreate it from the C++ class. Not ideal but at least it makes you keep the Blueprints lean and reminds you to transfer any changes you made in the Blueprint to code, which I think is best practice anyway.