x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Setting a HUD within the GameMode class

I am not quite sure what I am doing wrong here. I have successfully set my DefaultPawnClass previously, but for some reason the HUD just won't want to work. For some reason I can't change it within Project Settings either.

My code as of now is

 static ConstructorHelpers::FClassFinder<AHUD> HUDObject(TEXT("HUD'/Game/Blueprints/MyHUD_BP.MyHUD_BP'"));
 if (HUDObject.Class != NULL)
 {
     HUDClass = (UClass*)HUDObject.Class;
 }

I have figured out that the ClassFinder cannot find the blueprint, however I have it, I copied the path with Copy Reference just to be extra sure, plus the DefaulPawnClass has been initialised similarly ...

What am I missing ? Thanks in advance.

Product Version: UE 4.20
Tags:
more ▼

asked Oct 28 '18 at 11:26 PM in C++ Programming

avatar image

flying_ghetti
3 1 3

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hello, I believe it's done this way.

 AFPSGameMode::AFPSGameMode()
 {
     // set default pawn class to our Blueprinted character
     static ConstructorHelpers::FClassFinder<APawn> PlayerPawnClassFinder(TEXT("/Game/Blueprints/BP_Player"));
     DefaultPawnClass = PlayerPawnClassFinder.Class;
 
     // use the custom HUD class
     HUDClass = AFPSHUD::StaticClass();
 }
more ▼

answered Oct 29 '18 at 12:20 AM

avatar image

eriksnoww
56 3 3

avatar image flying_ghetti Oct 29 '18 at 01:15 AM

Thank you, it worked. I might just ditch the use of a HUD blueprint altogether.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question