Download

Save AStaticMesh actor refernce to use in Editor Utility Widget

Is there a way to save a reference to an actor on a level and use it in editor utility widget? Let’s say I have my save

UCLASS()
class AUTOHLODER_API UTestSave : public USaveGame
{
    GENERATED_BODY()
public:
    UPROPERTY(VisibleAnywhere, Category = Basic)
    AStaticMeshActor* SavedActor;
    
};

I save it like this:

UTestSave* Save = Cast<UTestSave>(UGameplayStatics::CreateSaveGameObject(UTestSave::StaticClass()));
Save->SavedActor = ActorToSave;
UGameplayStatics::SaveGameToSlot(Save, FString("TestSlot"), 0);

And load like this:

auto Load = Cast<UTestSave>(UGameplayStatics::LoadGameFromSlot(FString("TestSlot"), 0));
    auto Test = Load->SavedActor->GetName();

if I run the load in editor utility widget while i play in editor everything is fine but when I run the EUW on its own I get EXCEPTION_ACCESS_VIOLATION