Hey guys, I’m completely new at Unreal and just got out of Unity, and thought I’d give a try at scripting in this while following along Unreals Battery Game Tutorial found here https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gYup-gvJtMsgJqnEB_dGiM4/mSRov77hNR4/index.html
Everything more or less went smoothly until EP 13 where we incorporate the Tick function in the GameMode script, as my tick evidently isn’t seemingly running at all.
Here is the C++ Code ABatteryCollectorGameMode.cpp
#include "BatteryCollector.h"
#include "BatteryCollectorGameMode.h"
#include "BatteryCollectorCharacter.h"
#include "Kismet/GameplayStatics.h"
ABatteryCollectorGameMode::ABatteryCollectorGameMode()
{
//base Decay Rate
DecayRate = 0.01f;
}
void ABatteryCollectorGameMode::Tick(float DeltaTime)
{
Super::Tick( DeltaTime );
UE_LOG(LogClass, Log, TEXT("Battery Drain"));
}
And here is the head ABatteryCollectorGameMode.h
#pragma once
#include "GameFramework/GameModeBase.h"
#include "BatteryCollectorGameMode.generated.h"
UCLASS(minimalapi)
class ABatteryCollectorGameMode : public AGameModeBase
{
GENERATED_BODY()
public:
ABatteryCollectorGameMode();
virtual void Tick( float DeltaTime ) override;
protected:
//rate that power is reduced
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Power")
float DecayRate;
};
I trimmed out the largely irrelevant parts. I’m pretty new to C++ and UE4 in general, so if there is some glaring issues in the code or if there’s an issue with UE4 that I’m not aware of, I’d appreciate some feed back.
Thanks