As I said on the title I don’t understand what the problem is. I try to change the variables in MyPlayerController from another class and then the editor crashes. That happened too, for example, if I try MyPlayerController->GetName() from the MyGameMode.cpp.
I have indicated in them where the editor crashes.
Here are my two cpp:
Begin play isn’t going to be able to get a reference to your PlayerController, so when you try to get a reference, you are actually get a nullptr and then try to use that nullptr in UE_LOG, which causes your game to crash.
This is the function in the GameModeBase class that creates a PlayerController for your game. You can get a reference to it there:
This generate another problem, when i try CreateWidget, the editor say that the player controller hasn’t a Player.
Anyway, looking your answer I found a reason for my crash: In the UE_LOG I had put *(*MyPC->GetName()), instead of *MyPC->GetName( ). Thank you!