Announcement

Collapse
No announcement yet.

Getting access to the GameMode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    My GameState is empty.. Any ideas what might be failing?

    I am setting the class up in the gamemode:

    Code:
    GameStateClass = AGameState::StaticClass();
    and then inside my huds BeginPlay I am calling

    Code:
    UWorld* world = GetWorld();
    	GameState = world->GetGameState<AMainGameState>();

    Comment


      #17
      Code:
      GameState = Cast<AMainGameState>(world->GetGameState()); // ?

      Comment


        #18
        Yeah I had a problem doing it this way.

        Click image for larger version

Name:	wadawd.png
Views:	1
Size:	10.0 KB
ID:	1056498

        So you have to declare the template type:

        Code:
        	GameState = Cast<AMainGameState>(world->GetGameState<AMainGameState>());
        and then you may aswell get rid of the Cast...

        However, even with the Cast it doesn't seem to return the GameState set up in the GameMode

        Related: https://answers.unrealengine.com/que...urns-null.html ?
        related: https://forums.unrealengine.com/show...etworking-test

        errr.... I had a typo... YEHAAA IT WORKs.. THANKS ALL... Beers for ALL
        Last edited by jimmyt1988; 09-09-2014, 08:01 PM.

        Comment

        Working...
        X