If been struggling to solve this for two days now.
In my gameMode called AGameMode_Cell I got a enum in which I store which of two basic control settings is currently active.
I also got a blueprint derived from it in which I just set that the cursor is visible ingame.
I want to access my gameMode in my character controller through this code AGameMode_Cell* gameMode = Cast<AGameMode_Cell>(UGameplayStatics::GetGameMode(this));
Since I’m a good little coder I check if the cast is successful before continuing but it returns a nullptr every time.
So i checked what GetGameMode() actually returns and turns out it is of the type GameMode_Cell_C which is seemingly incompatible with AGameMode_Cell.
I’ve been trying other methods of casting it and also tried doing it completly in the character controller blueprint but it also didn’t work.
It would be fantastic if someone could help me with this problem. It’s been driving me crazy for like two days now.
I tried that command and the console didn’t output anything. So I tried it with ()->GetAuthGameMode()->GetClass()->GetName(). That returned GameMode_Cell_C
!!>First of all: I changed the bleuprint name to GameMode_Cell_BP because I tried something and wanted to stick to naming conventions which I hand’t previously. It shouldn’t affect this problem.
well sometimes references just simply not set when beginplay happens… since when you play in editor everything happens immediatly… and actor life cycles may spawn player / controller before world set his gamemode…