Should I store my DataTableRows in a Map for quicker access? I’m using a map which is really fast. When using FindRow I would think it would need to read line by line to find your row with the ID you want. This could be slow.
Here is some example code
// Fill out your copyright notice in the Description page of Project Settings.
#include "MovementActorComponent.h"
TMap<FName, FMovementDataTableRow*> UMovementActorComponent::MovementDatas;
//Called When Component Is Added To Actor
UMovementActorComponent::UMovementActorComponent()
{
PrimaryComponentTick.bCanEverTick = true;
}
// Called when the game starts
void UMovementActorComponent::BeginPlay()
{
Super::BeginPlay();
if (MovementDataTable != nullptr && !UMovementActorComponent::MovementDatas.Contains(MovementDataTableID))
{
FMovementDataTableRow* Data = MovementDataTable->FindRow<FMovementDataTableRow>(MovementDataTableID, "MOVEMENTDATA", false);
UMovementActorComponent::MovementDatas.Add(MovementDataTableID, Data);
}
}
// Called every frame
void UMovementActorComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
}