I’m trying to customize character movement, yet I’m getting this simple error and I’m not sure why:
…h(65): error : ‘Member variable declaration’ is not allowed before the Class definition
I’m pretty new to c++ so it’s probably something stupid. It doesn’t seem to matter where I put it. When I move the UPROPERTIES elsewhere it generates like 50 errors. Any help is greatly appreciated!!:
#pragma once
#include "GameFramework/CharacterMovementComponent.h"
#include "MyCharacterMovement.generated.h"
UCLASS()
class UMyCharacterMovement : public UCharacterMovementComponent
{
GENERATED_UCLASS_BODY()
public:
friend class FSavedMove_ExtendedMyMovement;
virtual void UpdateFromCompressedFlags(uint8 Flags) override;
virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
};
class FSavedMove_MyMovement : public FSavedMove_Character
{
public:
typedef FSavedMove_Character Super;
///@brief Resets all saved variables.
virtual void Clear() override;
///@brief Store input commands in the compressed flags.
virtual uint8 GetCompressedFlags() const override;
///@brief This is used to check whether or not two moves can be combined into one.
///Basically you just check to make sure that the saved variables are the same.
virtual bool CanCombineWith(const FSavedMovePtr& NewMove, ACharacter* Character, float MaxDelta) const override;
///@brief Sets up the move before sending it to the server.
virtual void SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character & ClientData) override;
///@brief Sets variables on character movement component before making a predictive correction.
virtual void PrepMoveFor(class ACharacter* Character) override;
uint8 bSavedWantsToSprint : 1;
};
class FNetworkPredictionData_Client_MyMovement : public FNetworkPredictionData_Client_Character
{
public:
FNetworkPredictionData_Client_MyMovement(const UCharacterMovementComponent& ClientMovement);
typedef FNetworkPredictionData_Client_Character Super;
///@brief Allocates a new copy of our custom saved move
virtual FSavedMovePtr AllocateNewMove() override;
};
UPROPERTY(EditAnywhere, Category = "Sprint")
float SprintSpeedMultiplier;
UPROPERTY(EditAnywhere, Category = "Sprint")
float SprintAccelerationMultiplier;
///@brief Activate or deactivate sprint.
void SetSprinting(bool bSprinting);
///@brief Flag for activating sprint.
uint8 bWantsToSprint : 1;
///@brief Override maximum speed during sprint.
virtual float GetMaxSpeed() const override;
///@brief Override maximum acceleration for sprint.
virtual float GetMaxAcceleration() const override;