tranek / GASDocumentation

My understanding of Unreal Engine 5's GameplayAbilitySystem plugin with a simple multiplayer sample project.
MIT License
4.52k stars 819 forks source link

Client crash on kill if no death montage set #46

Closed tommygod3 closed 3 years ago

tommygod3 commented 3 years ago

If a character has no death montage set then when they die they will be instantly destroyed. https://github.com/tranek/GASDocumentation/blob/3575672b22d5bfc4508f07b3ecb17479b18f5721/Source/GASDocumentation/Private/Characters/GDCharacterBase.cpp#L253-L266

This causes issues when a client kills a character because in AHSPlayerController::ShowDamageNumber_Implementation, TargetCharacter is null which causes a crash. https://github.com/tranek/GASDocumentation/blob/3575672b22d5bfc4508f07b3ecb17479b18f5721/Source/GASDocumentation/Private/Player/GDPlayerController.cpp#L70-L72

I don't know why this doesn't crash the server, it seems that when AHSPlayerController::ShowDamageNumber_Implementation runs on the server, TargetCharacter is not null. I'm not sure if there is a preferred way of fixing this but for now my quick fix has just been to add an if (TargetCharacter) inside AHSPlayerController::ShowDamageNumber_Implementation but I may add a timer in the future so damage numbers still show on death.

tranek commented 3 years ago

Good catch. A nullptr check and a timer is a good solution.