Download

Interface loss data

Hello

I have this code to send to game instance variable from a static function in my function library, the value is passed, apparently it works, but when the function ends the value sent is lost.
Could someone tell me what I’m doing wrong?

To be more exact the variable that is lost is “CreatedSlot” in the last line of code.




if (GameInstance->GetClass()->ImplementsInterface(UGameInstanceInterface::StaticClass()))
{
    IGameInstanceInterface::Execute_GetDefaultSlotName(GameInstance);
    CreatedSlot.Append(FString::FromInt(CheckedSlot));
    UGameplayStatics::SaveGameToSlot(SaveGameObject, CreatedSlot, 0);
    IGameInstanceInterface::Execute_SetCurrentSlot(GameInstance, CreatedSlot);
}