Binary Compressed Save System, Save Entire Dynamically Generated Worlds! ♥ Rama

Hi Rama,

I’m using your plugin and have run into an issue when working with level streaming. When actors are being spawned into the world, there is no way to control the Level that they are being spawned into. When I load a streamed level and then load its persisted state using your plugin, I sometimes want those spawned actors to spawn into the streamed level, not into persistent level.

One way to achieve this would be to change this:


static bool RamaSave_LoadFromFile(UWorld* World, int32 RamaSaveSystemVersion, const TArray<FString>& LoadActorsWithSaveTags, FArchive &Ar
, URamaSaveComponent*& LoadedComp, bool DontLoadPlayerPawns, FString LoadOnlyStreamingLevel="");

to this:


static bool RamaSave_LoadFromFile(UWorld* World, int32 RamaSaveSystemVersion, const TArray<FString>& LoadActorsWithSaveTags, FArchive &Ar
, URamaSaveComponent*& LoadedComp, bool DontLoadPlayerPawns, FString LoadOnlyStreamingLevel="", bool bSpawnIntoStreamingLevel=false);

And then change this:


template <typename VictoryObjType>
    static FORCEINLINE VictoryObjType* SpawnBP(
        UWorld* TheWorld,
        UClass* TheBP,
        const FVector& Loc,
        const FRotator& Rot = FRotator::ZeroRotator,
        const bool bNoCollisionFail = true,
        AActor* Owner = NULL,
        APawn* Instigator = NULL
    )

to this:


template <typename VictoryObjType>
    static FORCEINLINE VictoryObjType* SpawnBP(
        UWorld* TheWorld,
        UClass* TheBP,
        const FVector& Loc,
        const FRotator& Rot = FRotator::ZeroRotator,
        const bool bNoCollisionFail = true,
        AActor* Owner = NULL,
        APawn* Instigator = NULL,
        ULevel* OverrideLevel = NULL
    )

And then down where you are setting up the spawn info, add this:


if(OverrideLevel)
{
    SpawnInfo.OverrideLevel = OverrideLevel;
}

Then we could add in RamaSave_LoadFromFile an if statement on bSpawnIntoStreamingLevel to determine if we find and pass in the level specified with LoadOnlyStreamingLevel as an argurment to SpawnBP.

Regards,
Modeus Mark