New Level Sequence not showing in Content Browser

Hello. I’ve creating a new level sequence via C++ and it creates the uasset on disk but is not visible in the content browser. I’m in Unreal 5.5 and Visual Studio version 17.11.2. Any help as to why this is would be appreciated as I create one via python and it work fine. Thanks in advance. Joe

    UPackage* Package = CreatePackage(*FString("/Game/Shots/NewLevelSequence"));
    ULevelSequence* LevelSequence = NewObject<ULevelSequence>(
        Package, ULevelSequence::StaticClass(), NAME_None, RF_Public | RF_Standalone);
    LevelSequence->Initialize();

    // get package name and file path
    const FString PackageName = Package->GetName();
    const FString PackageFileName = FPackageName::LongPackageNameToFilename(
        PackageName, FPackageName::GetAssetPackageExtension());

    // create the save args
    FSavePackageArgs SaveArgs;
    SaveArgs.TopLevelFlags = RF_Public | RF_Standalone;
    SaveArgs.SaveFlags = SAVE_NoError;
    UPackage::SavePackage(Package, nullptr, *PackageFileName, SaveArgs);

Try calling:

FAssetRegistryModule::AssetCreated(LevelSequence);

Hi Max. Thanks for your response. The same problem exists which is strange. I’ve added to the code to open the level sequence and I click on the show in content browser and it goes to the correct folder but it doesn’t show up.

Thanks. Joe

Sorry not quite sure why it isn’t working. Does it reappear if you save the asset and or restart the engine?

No its very strange Max, if I save and restart it show in the content browser. The python version works fine.

            asset_tools = ue.AssetToolsHelpers.get_asset_tools()
            sequence = ue.AssetTools.create_asset(
                asset_tools,
                asset_name=asset_name,
                package_path=package_path,
                asset_class=ue.LevelSequence,
                factory=ue.LevelSequenceFactoryNew()
            )

Not sure if the c++ command is incorrect and should use the AssetToolsModule given in this example:

Though is seems like over kill seeing as it is all working just not showing up in the browser.

Thanks.

I have noticed when it does the asset register it logs this:

LogContentValidation: Display: Starting to validate 0 assets
LogContentValidation: Enabled validators:
LogContentValidation:     /Script/DataValidation.EditorValidator_Material
LogContentValidation:     /Script/DataValidation.DirtyFilesChangelistValidator
LogContentValidation:     /Script/DataValidation.EditorValidator_Localization
LogContentValidation:     /Script/DataValidation.PackageFileValidator
LogContentValidation:     /Script/DataValidation.WorldPartitionChangelistValidator
LogContentValidation:     /Script/InputBlueprintNodes.EnhancedInputUserWidgetValidator

Is there something I need to run to register the asset other than:

FAssetRegistryModule::AssetCreated(LevelSequence);

Thanks very much. Joe

Instead of this:

    ULevelSequence* LevelSequence = NewObject<ULevelSequence>(
        Package, ULevelSequence::StaticClass(), NAME_None, RF_Public | RF_Standalone);

try this:

	ULevelSequence* LevelSequence = NewObject<ULevelSequence>(
		Package, "NewLevelSequence", RF_Public | RF_Standalone);

He’s cracked it! Thanks Max that worked. Much appreciated!

1 Like