3

I've been working on an Unreal Engine 4 game using C++ and I've been working on a dash function, however I followed a YouTube tutorial and I noticed that in the video, they use the function "EditAnywhere" but when I tried to code that my self, my UE4 says that EditAnywhere is unknown function.

Do I need to meet some special requirements to be able to use the "EditAnywhere" function?

My Header file sample code:

UFUNCTION()
void DoubleJump();

UPROPERTY()
int DoubleJumpCounter;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
float JumpHeight;

UFUNCTION()
void Sprint();

UFUNCTION()
void Walk();

UPROPERTY(EditAnywhere)
float WalkingSpeed;

UPROPERTY(EditAnywhere)
float RunningSpeed;

UFUNCTION(EditAnywhere)
void Dash();

UPROPERTY()
bool CanDash;

UPROPERTY(EditAnywhere)
float DashStop;

UPROPERTY()
FTimerHandle UnsedHandle;

UFUNCTION()
void StopDashing();

UFUNCTION()
void ResetDash();

Here is a picture of the Error message enter image description here

JeJo
  • 30,635
  • 6
  • 49
  • 88

2 Answers2

4

You can not have the EditAnywhere for functions!

The EditAnywhere is a property declaration meant only for the variables.

Properties are declared using standard C++ variable syntax, preceded by the UPROPERTY macro which defines property metadata and variable specifiers.

UPROPERTY([specifier, specifier, ...], [meta(key=value, key=value, ...)])
Type VariableName;

Do I need to meet some special requirements to be able to use the "EditAnywhere" function?

Editing functions does not make any sense, but you can specify the function how to act in different places(Example: blueprint, unreal editor, etc). This has been done via UFUNCTION declaration. See the different declarations in the given link for further read.

JeJo
  • 30,635
  • 6
  • 49
  • 88
3

You can't use EditAnywhere with a UFUNCTION, only with a UPROPERTY. What would it even mean to make a function editable by property windows?

See Property Specifiers and Function Specifiers for the complete list of supported specifiers.

Thomas
  • 174,939
  • 50
  • 355
  • 478