Collision/Phyiscs fixes, tried moving actors between levels by chanigng outer and renaming but SPUD cant handle that, so will probably destroy / respawn

This commit is contained in:
Simeon "Waldo" Wallrath 2025-10-28 16:57:47 +01:00
parent 51520c49b9
commit 2775763bfd
15 changed files with 81 additions and 21 deletions

View file

@ -0,0 +1,23 @@
#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,16 @@
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CodeOnlyFunctionLibrary.generated.h"
UCLASS()
class NO_API UCodeOnlyFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="Utilities|Actor")
static FString RenameActorUnique(AActor* ActorToRename, const FString& DesiredName, AActor* ReferenceActorForLevel);
};