I cannot for the life of me, figure out how to make my customer PlayerController auto possess my Pawn. Here’s my scenario:
I have custom PlayerController (RTS_PlayerController)
I have a Pawn (RTS_Camera)
I have my custom GameMode (RTS_GameMode)
I have a custom GameState (RTS_GameState)
And I have a custom GameInstance (RTS_GameInstance)
In my project settings, under “Maps and Modes”, I’ve set the following settings:
Default GameMode - RTS_GameMode
Default Pawn Class - RTS_Camera
HUD Class - None
Player Controller Class - RTS_PlayerController
Game State Class - RTS_GameState
Player State Class - PlayerState (default)
Spectator Class - SpectatorPawn (default)
I’m not quite sure how to make my PlayerController auto possess my Pawn, and I fear that this has something to do with these modes settings that I don’t quite understand?
Help and ideas are much appreciated
Placing another pawn into my scene, I can see that this pawn gets auto possessed by my player controller, however, my Event Begin Play event is not hit. What could cause this, and why doesn’t this happen?
Further investigating I noticed that if I remove the execution of my input events (see image below) the pawn DOES NOT move at all, so those events are being hit. Still not understanding why my begin play event isn’t hit.
If you edit your custom GameMode, is your custom character controller and custom pawn set as the defaults? Are the world settings of the Map you are loading also using your custom GameMode? The GameMode you select in Maps and Modes can be overridden by your map’s world settings.
He means the top right window in Unreal where it shows actors in the level. Is your custom pawn in the level? or only the default pawn? If its the default pawn then your custom pawn is not being spawned. If your custom pawn is in there, it means its being spawned but not possed by your custom player controller
It adds another camera in the scene though:, called CameraActor. This seems like some default camera it throws into the scene. Remember, the controls work fine, and it DOES posses my camera, but my EventBeginPlay is not being hit. That’s my main problem. I can navigate with WASD as expected, but the begin play is not triggered.
Thats an unusual Create Widget node, is this inside your Pawn or Player Controller? What is the RTS pin at the bottom of the create widget node? Try adding a Print String to the end to see if the BeginPlay is firing at all.
What is the red dot at the top left of the node also? I havent seen that before
The read dot is just a debugging point, as I wanted to try and debug my way into this Unfortunately, this is never hit. It doesn’t make sense to add a print string to the begin play because, as mentioned, the debug point isn’t hit at all, therefore the Event BeginPlay is never triggered.
What’s wrong with my Create HUD widget? I’ve just implemented an interface as I need to controller and the pawn inside my widget
Ahhh ok, sorry I hadnt seen that debug point before I will look into that. Could maybe try putting it into the construction script instead because this will definitely be fired since your pawn is spawned
CreateWidget looks normal (‘Expose on Spawn’ exposes an RTS var).
Its just a breakpoint to stop execution / test the code is being hit…
When debugging its essentially the same as a Print String node etc.
BeginPlay just shows HUD setup. Where’s Possession in any of this…
What’s that Blueprint anyway, maybe its actually never being called.
Add manual CreatePlayer / Possess nodes to show what’s going on???