I’m writing a BFS algorithm which is a static method of a simple struct called Algorithm.
Here is the sample code:
void Algorithm::BFS(const T&, const FIntPoint&)
{
int a = 0;
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Cyan, FString::FromInt(a));
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Cyan, FString::FromInt(233))
}
That’s it, no issue found in compile, but after build the project and start editor, access violation happened, both debug function will generate same issue (by annotate one of two):
stack is as follows: <~Desensitized~>
UnrealEditor_Engine
UnrealEditor_<~PROJECTNAME~>!Algorithm::BFS()
<~some call path~>
UnrealEditor_CoreUObject
the second line shows the error line of the cpp files which indicate the issue is at AddOnScreenDebugMessage.
I encountered this issue in another situation, when debugging some variable in C++ default constructor.
Since UE Crash reporter doesn’t give more details of which line encounter this issue in Engine instance, thus I’m so confused and don’t know how to fix this.
Is there any idea why it happened or possible direction on debugging this issue?
Thanks.