if you’ve just completed this tutorial on line tracing and find that your program repeatedly crashes when you run it, then the cause may be the lack of this statement:
if(ActorHit) { //… }
This statement is actually extremely important from what I can tell of the program as it checks for invalid pointers (read null pointers). the FHitResult object seems to return a null pointer when the raycast doesn’t find any object to return: a null pointer is a pointer that isn’t assigned to any object and any attempt to access the pointer results in undefined behavior. When you start your game up (assuming you didn’t place the objects right in front of your face) the game will crash as soon as UE_Text accesses the pointer object.
remember that the above if statement is equivalent to:
if(ActorHit does not equal null pointer) { //… }