Level Instance seem like a viable alternative to Prefab. However Level Instance usability leaves to be desired. I would like to be able to create a Packed Level Actor simply by right clicking on a level in the content browser. I shouldn’t have to right click in on an existing level instance in the outliner.
Furthermore, when creating a level instance actor from an a level instance, an additional level is created which I am hoping will be in sync with the corresponding BP that was created.
First of all why can’t I just use the level instead of creating a new level asset to be used by the BP?
Second of all, I have noticed that when adding shapes into the original level, I would like the BP to be automatically synced. I believe this was the intention however no changes are visible in the resulting packed level BP (EDIT: I have found that we have to keep it in sync manually )
My last point is that is impossible to use Modelling tool like Cube Grid in connection with Level Instance blueprint because this feature is unavailable in the BP editor.
Because of all these issues, I am using the Prefabricator package as a workaround.
Creating a Packed Level Actor from selected Level in the Content Browser is as easy as this. It’s unfortunate it’s not there by default. Seem like a reasonable workflow (much easier than dragging the level into the scene and creating from there).
void CreatePackedLevelActor(TArray<FAssetData> SelectedAssets)
{
using namespace Courage;
if (SelectedAssets.Num())
{
const FAssetData& AssetData = SelectedAssets[0];
if (auto world = Cast<UWorld>(AssetData.GetAsset()))
{
FString name = world->GetName();
name = name.Replace(L"Level_", L"PackedLevel_");
UBlueprint* blueprint = CreateBlueprintOnContentBrowser<APackedLevelActor>(name, true);
//FPackedLevelActorUtils::CreateOrUpdateBlueprint(level->GetWorld(), blueprint);
FPackedLevelActorBuilder::CreateDefaultBuilder()->CreateOrUpdateBlueprint(world, blueprint, true, true);
}
}
}
One of my other gripe with PackedLevelActor is that all the InstancedStaticMesh components lose their name correspondence with their StaticMeshActor counterpart.
This makes it difficult to write construction script referring to the components. I believe the problem is due to how unlike actors, components do not have distinct names and label.
In 4.3 you can select any assets in your level, Right Click, and choose Level - Create Level Instance.
These are less limiting than Packed Level Actors as they aren’t limited to only static meshes, but they’re not as performant since they don’t fuse similar meshes together for a single draw call and they aren’t creating Instanced Static Meshes of every actor referenced in the scene. They still provide a performance boost in that placing multiple of them in a scene means only one draw call for all of the assets. That said, converting a bunch of actors in a scene into a level instance, but only using said instance once in your level, provides no performance boost at all. The advantage comes when you want to place the collection of actors down multiple times.
The Packed Level Actor is also similarly easy to create Right-click and choose Level - Create Packed Level Actor. This only works with static meshes and can contain no other type of actor, but is even more performant than a level instance with the aforementioned fusing of meshes and mesh instancing within the actor itself.
Finally, you can combine Packed Level Actors and Level Instances for the best of both worlds. You can convert all of the static meshes inside your level Instance into a Packed Level Actor and then use that inside of your Level Instance and drop the Level Instance in your map for multiple versions of the same asset (IE buildings etc.)