C++ Implementation GameInstance save, also some cleanup of unsued C++ classes

This literally took me days, as it turn out that the timing offset between C++ and BP Init of GameIstance caused it to not be added as a GlobalObject to SPUD correctly.
This commit is contained in:
Simeon "Waldo" Wallrath 2025-12-11 17:22:52 +01:00
parent ff4cff2b5d
commit 362b5ff23f
18 changed files with 72 additions and 112 deletions

View file

@ -1,23 +0,0 @@
#include "CodeOnlyFunctionLibrary.h"
#include "GameFramework/Actor.h"
#include "Engine/Level.h"
FString UCodeOnlyFunctionLibrary::RenameActorUnique(AActor* ActorToRename, const FString& DesiredName, AActor* ReferenceActorForLevel)
{
if (!ActorToRename || !ReferenceActorForLevel)
{
return FString();
}
FString NewName = DesiredName;
while (!ActorToRename->Rename(*NewName, ReferenceActorForLevel->GetLevel(), REN_Test))
{
UE_LOG(LogTemp, Warning, TEXT("Rename conflict on drop: %s"), *NewName);
NewName.AppendChar('x');
}
ActorToRename->Rename(*NewName, ReferenceActorForLevel->GetLevel());
return NewName;
}

View file

@ -0,0 +1,19 @@
#include "CustomAdvancedFriendsGI.h"
#include "Engine/World.h"
#include "Engine/Engine.h"
#include "SpudSubsystem.h"
void UCustomAdvancedFriendsGI::Init()
{
Super::Init();
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green,
TEXT("CustomAdvancedFriendsGI::Init() called"));
}
GetSpudSubsystem(GetWorld())->AddPersistentGlobalObjectWithName(this, TEXT("ExampleGameInstance"));
}

View file

@ -1,12 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "WidgetHelper.h"
WidgetHelper::WidgetHelper()
{
}
WidgetHelper::~WidgetHelper()
{
}