ListPackageContents

ListPackageContents

#Overview

name: ListPackageContents

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ListPackageContents is to provide a diagnostic tool for listing the contents of a UPackage object in Unreal Engine. This function is part of the Blueprint editing and management system within the Unreal Editor.

This setting variable is primarily used by the UnrealEd module, specifically within the BlueprintEditorUtils class. It’s part of the Blueprint editing and diagnostic toolset, which is crucial for developers working with Blueprints in the Unreal Engine editor.

The value of this variable is not set directly, as it’s actually a function rather than a traditional variable. It’s invoked as a method of the FBlueprintEditorUtils class.

ListPackageContents interacts with the UPackage system and the FOutputDevice for logging. It iterates through objects using FThreadSafeObjectIterator to find objects that have the specified Package as their outer object.

Developers should be aware that this function is intended for diagnostic purposes only. It should not be used in production code or gameplay logic. It’s primarily a tool for debugging and inspecting package contents during development.

Best practices when using this function include:

  1. Only use it in editor-time code, not in runtime game code.
  2. Be cautious about performance implications when used on large packages, as it iterates through all objects.
  3. Use it in conjunction with other Blueprint diagnostic tools for comprehensive debugging.
  4. Ensure proper error handling when calling this function, especially when dealing with potentially non-existent packages.

This function is particularly useful for developers working on tools or systems that involve package management or Blueprint editing within the Unreal Engine editor environment.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Kismet2/BlueprintEditorUtils.cpp:8286

Scope (from outer to inner):

file
function     void FBlueprintEditorUtils::ListPackageContents

Source code excerpt:

}

void FBlueprintEditorUtils::ListPackageContents(UPackage* Package, FOutputDevice& Ar)
{
	Ar.Logf(TEXT("Package %s contains:"), *Package->GetName());
	for (FThreadSafeObjectIterator ObjIt; ObjIt; ++ObjIt)
	{
		if (ObjIt->GetOuter() == Package)
		{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Kismet2/BlueprintEditorUtils.cpp:8429

Scope (from outer to inner):

file
function     bool FBlueprintEditorUtils::KismetDiagnosticExec

Source code excerpt:

		Ar.Logf(TEXT("\nFinished listing illegal private references"));
	}
	else if (FParse::Command(&Str, TEXT("ListPackageContents")))
	{
		if (UPackage* Package = FindPackage(nullptr, Str))
		{
			FBlueprintEditorUtils::ListPackageContents(Package, Ar);
		}
		else
		{
			Ar.Logf(TEXT("Failed to find package %s"), Str);
		}
	}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/Kismet2/BlueprintEditorUtils.h:1627

Scope (from outer to inner):

file
class        class FBlueprintEditorUtils

Source code excerpt:


	// Diagnostic use only: Lists all of the objects have a direct outer of Package
	static UNREALED_API void ListPackageContents(UPackage* Package, FOutputDevice& Ar);

	// Diagnostic exec commands
	static UNREALED_API bool KismetDiagnosticExec(const TCHAR* Stream, FOutputDevice& Ar);

	/**
	 * Searches the world for any blueprints that are open and do not have a debug instances set and sets one if possible.