The ability to override CanJump using only C++ has been removed!
Why are you doing this?
Please dont make it a trend to force things to be done in BP, as the only option!
Especially if we used to be able to do it just in c++ by overriding a virtual function!
What if I had implemented logic in C++ that I cant easily convert into BP without re-writing a lot of my game code?
I was actually creating a custom implementation purely in c++ which I now have to find a way to convert into BP
please dont do this…
Rama
/**
* Check if the character can jump in the current state.
*
* The default implementation may be overridden or extended by implementing the custom CanJump event.
*
* @Return Whether the character can jump in the current state.
*/
UFUNCTION(BlueprintCallable, Category="Pawn|Character")
bool CanJump() const;
protected:
/**
* Customizable event to check if the character can jump in the current state.
* Default implementation returns true if the character is on the ground and not crouching,
* has a valid CharacterMovementComponent and CanEverJump() returns true.
* Default implementation also allows for 'hold to jump higher' functionality:
* As well as returning true when on the ground, it also returns true when GetMaxJumpTime is more
* than zero and IsJumping returns true.
*
* @Return Whether the character can jump in the current state.
*/
UFUNCTION(BlueprintNativeEvent, Category="Pawn|Character|InternalEvents", meta=(FriendlyName="CanJump"))
bool CanJumpInternal() const;
CanJump is implementable in C++, but because we wanted to expose it as a BlueprintNativeEvent as well, the syntax required is not ‘just’ a virtual function override.
But I do not see the function you show above in 4.2 release as obtained from source files on GitHub
I am confused as to why you are showing an OVERRIDE for a function I do not see anywhere.
Is it just that I have to add this function signature, even though there is no base function to override?
Here’s all that I have related to CanJump in Character.h
So as a result I still cannot implement CanJump in CPP
/**
* Check if the character can jump in the current state.
*
* The default implementation may be overridden or extended by implementing the custom CanJump event.
*
* @Return Whether the character can jump in the current state.
*/
UFUNCTION(BlueprintCallable, Category="Pawn|Character")
bool CanJump() const;
protected:
/**
* Customizable event to check if the character can jump in the current state.
* Default implementation returns true if the character is on the ground and not crouching,
* has a valid CharacterMovementComponent and CanEverJump() returns true.
* Default implementation also allows for 'hold to jump higher' functionality:
* As well as returning true when on the ground, it also returns true when GetMaxJumpTime is more
* than zero and IsJumping returns true.
*
* @Return Whether the character can jump in the current state.
*/
UFUNCTION(BlueprintNativeEvent, Category="Pawn|Character|InternalEvents", meta=(FriendlyName="CanJump"))
bool CanJumpInternal() const;
You wont see it in the class header for ACharacter because it is part of generated code now (inserted into the class via the GENERATED_UCLASS_BODY() macro). The implementation is there, you can find it in Character.cpp.
That’s terribly confusing for people I think could you make sure everyone avoids sticking stuff into places we can’t easily search for when perusing the code base?
I would not have figured this out any time unless you explained to me, as I normally search the .h files to look for virtual functions to implement