Hey Guys, my problem is…
… when I whould like to play my game, my editor crashs. I have an standard GameMode, but with a custom PlayerController. Compiling works.
If you have BSP on your level, then the cause may be in 28 and 29 line of code of your PlayerControll.cpp file.
In line 28 you assume, that whenever you hit anything, it’s already an actor, which is wrong. BSP for example isn’t a an actor (thus hit.GetActor() returns nullptr), yet it could be detected by your linetrace. I’m not sure if there are any other objects like BSP that would block linetrace despite the fact they aren’t actual actors.
Anyway, to fix this you could replace your condition in 28th line to this:
Also, not something that important, but in line 11, you don’t have to cast ‘this’ to AActor since APlayerController is deriving from AActor class. You can simply make it
It’s an additional thing i’ve seen in your code. Casting APlayerController to AActor shouldn’t cause any problems, but it’s simply redundant, that’s all.
I just tested it and it seems that the issue is with where you’re getting your references to world and camera manager. You do that in constructor, while these objects doesn’t exist yet.
Moving these:
PC_World = PC_Actor->GetWorld();
cm = PlayerCameraManager;
To - for example - BeginPlay should solve the issue.