I made the mistake of putting this line into the UHealthComponent constructor, which caused my project to crash:
GetOwner()->OnTakeAnyDamage.AddDynamic(this, &UHealthComponent::TakeDamage);
I’ve since moved it out of the constructor and into BeginPlay(), and then built in VS Code. Unfortunately, my project still crashes on startup with the same error. Line 14 of HealthComponent.cpp was the original line in the constructor, so Unreal isn’t recognizing that I’ve updated the code:
Assertion failed: DelegateOwner->IsValidLowLevelFast(false) [File:C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\CoreUObject\Public\UObject/SparseDelegate.h] [Line: 196]
UE4Editor_Core
UE4Editor_Core
UE4Editor_ToonTanks_1166!UHealthComponent::UHealthComponent() [E:\User\Documents\Projects\Unreal\ToonTanks\Source\ToonTanks\Components\HealthComponent.cpp:14]
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_Core
UE4Editor_Core
UE4Editor_Projects
UE4Editor_Projects
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
How do I fix the project so that I can open it and continue?