void type is only valid as a return type [UnrealHeaderTool Error]
![]()
you are mixing UPROPERTY with UFUNCTION. In this particular case it should be UFUNCTION(BlueprintCallable), while UPROPERTY() is used before variables (properties)
Use chat GPT (it is decent for function declarations and unreal macros):
“for unreal 5, i need declaration of function that is blueprint callable, pure. In C++ its called HitDetect() , however in blueprints i want its node to be called PlayerHitDetect , it has no parameters and returns no value”
its reply to above prompt:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Player")
void PlayerHitDetect();
and:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Player")
void PlayerHitDetect()
{
HitDetect();
}
void HitDetect()
{
// Implementation of your hit detection logic
}
Really helps to find where mistake was. Or just type in (copy/paste) code and error and usually it finds what is wrong (unless it is some logical stuff, where it kind of fails with non standard/common code).
ps.
And usual chatgpt error. It did not add part to rename node in blueprints, instead it added category “player”, and wrapped C++ function with another function to rename node. So always double check what it produces.
Why i try to use UPROPERTY with function? Noob question, easy solution. Thanks.