Announcement

Collapse
No announcement yet.

[UE4.24] Question about GetPlayerController

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

    [UE4.24] Question about GetPlayerController

    Hi all. I want to implement a function to open a new map in a Slate Widget class
    Code:
    void SMenuWidget::EnterGame()
    {    
        UGameplayStatics::OpenLevel(UGameplayStatics::GetPlayerController(GWorld, 0)->GetWorld(), FName("NewGameMap"));
    }
    but, it's crashed. The reason is UGameplayStatics::GetPlayerController(GWorld, 0) return null

    why is this?

    Thanks for any thoughts!
Working...
X