I don’t know why this is happening cause the code works for a while but after the functions get called a few times the engine crashes. Both functions are input functions.
Crashes on these line:
if (LockedOnWidget->GetWidgetClass() != nullptr)
LockedOnWidget is a UWidgetComponent*
if (LockedOnActor != nullptr)
LockedOnActor is an AActor*
Any suggestions or reasons for this would be appreciated.
Thanks in advance.
Oh sorry forgot to mention they’re in different cpp files. LockedOnActor* check(see if its been set) is in the character class and is used to access a function in the pawn class that uses LockedOnWidget->GetWidgetClass() check(see if its been set).
The most likely thing is the object containing your comparison is dodgy. What is the this ptr for the object as it crashes? What is the flow to the function that is crashing? as perhaps the object has been GC’d but still being trigger by a timer or somthing.