What i understood from PositionReport .cpp and .h

I commented what i understood and what i don’t as bellow.
I actually dont know why my code is a bit different, maybe thats something related to my UE version witch is newer.

PositionReport.h:

// Fill out your copyright notice in the Description page of Project Settings.

#include "PositionReport.h" // including the header file

// Sets default values for this component's properties
UPositionReport::UPositionReport() // our constructor
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true; // reset initialization

	// ...
}


// Called when the game starts
void UPositionReport::BeginPlay() // one of our public methods
{
	Super::BeginPlay(); // super is for calling the method from where the class inherited it and then we can add things to it, otherwise we will overrite the inherited method and the codes written in the parent wont work

	// ...
	
}


// Called every frame
void UPositionReport::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) // one of our public methods
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);  // super is for calling the method from where the class inherited it and then we can add things to it, otherwise we will overrite the inherited method and the codes written in the parent wont work

	// ...
}



PositionReport.cpp:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once // this file will only be called once in entire project

// the files that ae included in this file
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PositionReport.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) // i dont recognize this
class BUILDINGESCAPE_API UPositionReport : public UActorComponent // i only know that this is a class called UPositionReport and it inherits from a public class called UActorComponent and i dont undrestand BUILDINGESCAPE_API
{
	GENERATED_BODY() // i dont know whats this but i think its something that relates to whatever this class is inheriting from

public:	// easy, our public where we store all functions that can be used from outside
	// Sets default values for this component's properties
	UPositionReport(); // our constructor

protected:	// easy, our private where we store all helper functions and private variables
	// Called when the game starts
	virtual void BeginPlay() override;

public: // i dont undrestand why we have two publics here!
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

		
};

Privacy & Terms