Hi !
When I type faulty code that the compiler doesn’t see, I press play and Unreal Editor crashes and i have to relaunch everything again.
I tried inserting the code in a try/catch but Unreal Editor still crashes.
Here is the code that will cause Unreal to crash :
FVector PlayerViewPointLocation;
FRotator PlayerViewPointRotation;
/// OUT means this variables will be modified by the function.
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
OUT PlayerViewPointLocation,
OUT PlayerViewPointRotation
);
try {
UE_LOG(LogTemp, Warning, TEXT("Location: %s"), PlayerViewPointLocation); //instead of *PlayerViewPointLocation.ToString()
}catch(int e) {
UE_LOG(LogTemp, Error, TEXT("there is an uncatched error right there, c++ !!"));
}`
What I had forgotten was, first the method .ToString(), and that is should be a pointer and not the variable ( *PlayerViewPointLocation.ToString() )
I have two questions :
- Can i prevent crashes when I write code I am not sure about ? Should the try catch not prevent crashing ?
- Where are the logs, and where to find the relevant reports ?
Thanks !