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"

GameMode Reference always NULL (Multiplayer)

Hey guys,

after several hours of bug tracking I finally managed to track down to a very big problem, as the GameMode-Reference I get from GetWorld()->GetAuthGameMode() returns always NULL, but only on the client. The same code is also executed on the Server and works fine. Any ideas? (I basically do nothing with the GameMode besides getting a reference to it in the whole game, so there are no modifications which could lead to a NULL-Pointer) Here is the code snippet of the problem ..: (basically just Logging, but it always logs: "GameMode == NULL, ArenaCharacter.cpp : OnDeath")

 UWorld* world = GetWorld();
 if (world)
 {
 
 AARGameMode* gameMode = world->GetAuthGameMode<AARGameMode>();
     if (gameMode != NULL)
     {
         if (this->GetController() != NULL)
         {
                      //TODO
         }
         else
         {
         UE_LOG(GeneralLog, Fatal, TEXT("GETCONTROLLER() == NULL, ArenaCharacter.cpp : OnDeath"));
         }
     }
      else
       {
         UE_LOG(GeneralLog, Error, TEXT("GameMode == NULL, ArenaCharacter.cpp : OnDeath"));
        }
 }


Thanks in advance!

Product Version: Not Selected
Tags:
more ▼

asked Aug 08 '14 at 01:14 PM in C++ Programming

avatar image

Nanoxin
306 36 39 44

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

GameMode is a server side only object. The GameState object is what is used to replicate the GameMode state to clients. This is analogous to PlayerControllers and PlayerStates. The PlayerController only exists on the server and the client that owns it, all others can only interact with the PlayerState

more ▼

answered Aug 09 '14 at 12:42 AM

avatar image

joeGraf STAFF
1.5k 35 12 69

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I don't think the GameMode is replicated to the clients. I believe it is on the server only, and the GameState is replicated.

more ▼

answered Aug 08 '14 at 11:50 PM

avatar image

csharp1024
108 7 10 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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