[Mono-ue] How to set the Default Player Character in Game Mode

Ryan Burnham nitro52 at iinet.net.au
Wed Dec 31 11:18:35 UTC 2014

Hi All,

So I thought I would try to go through the Gettings Started: Introduction to
UE4 Programming tutorial
and convert it to C# using Mono of UE. 

This required me to convert the PlayerCharacter to c#. I've gone through and
done this but I'm trying to figure out now how to set it up as the default
player character. Basing it on this tutorial
https://wiki.unrealengine.com/First_Person_Shooter_C%2B%2B_Tutorial I can
see you need to setup a new game mode in code and then initialise the
DefaultPlayerPawn to the blueprint inherited from the custom
PlayerCharacter. In C++ it looks like this



AFPSGameMode::AFPSGameMode(const class FPostConstructInitializeProperties&
: Super(PCIP)
      // set default pawn class to our Blueprinted character
      static ConstructorHelpers::FObjectFinder<UBlueprint>
      if (PlayerPawnObject.Object != NULL)
             DefaultPawnClass =
I'm no C++ expert so I'm not sure if I am missing something but I can't
figure out how to convert this in the C# Mono for UE equivalent. So far I
have this

    public class CSharpGameMode : GameMode
        // Constructor called when creating or loading an object
        protected CSharpGameMode(PostConstructInitializeProperties pcip) :
            var playerPawnObject = new ObjectFinder<Blueprint>();

            if (playerPawnObject.Object != null)
                DefaultPawnClass = //<------- How do i get SubclassOf
<Pawn> from the ObjectFinder;

        // Constructor for hot-reloading. UProperties will already be
initialized, but any purely managed fields or data
        // will need to be set up
        protected CSharpGameMode(IntPtr nativeObject) : base(nativeObject)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-ue/attachments/20141231/62408411/attachment.html>

More information about the Mono-ue mailing list