UnrealPackage

Namespace: UAssetAPI

public abstract class UnrealPackage : UAssetAPI.IO.INameMap

Inheritance ObjectUnrealPackage
Implements INameMap

Fields

Info

Agent string to provide context in serialized JSON.

public string Info;

FilePath

The path of the file on disk that this asset represents. This does not need to be specified for regular parsing.

public string FilePath;

Mappings

The corresponding mapping data for the game that this asset is from. Optional unless unversioned properties are present.

public Usmap Mappings;

UseSeparateBulkDataFiles

Should the asset be split into separate .uasset, .uexp, and .ubulk files, as opposed to one single .uasset file?

public bool UseSeparateBulkDataFiles;

IsUnversioned

Should this asset not serialize its engine and custom versions?

public bool IsUnversioned;

FileVersionLicenseeUE

The licensee file version. Used by some games to add their own Engine-level versioning.

public int FileVersionLicenseeUE;

ObjectVersion

The object version of UE4 that will be used to parse this asset.

public ObjectVersion ObjectVersion;

ObjectVersionUE5

The object version of UE5 that will be used to parse this asset. Set to ObjectVersionUE5.UNKNOWN for UE4 games.

public ObjectVersionUE5 ObjectVersionUE5;

CustomVersionContainer

All the custom versions stored in the archive.

public List<CustomVersion> CustomVersionContainer;

Exports

Map of object exports. UAssetAPI used to call these "categories."

public List<Export> Exports;

WorldTileInfo

Tile information used by WorldComposition. Defines properties necessary for tile positioning in the world.

public FWorldTileInfo WorldTileInfo;

MapStructTypeOverride

In MapProperties that have StructProperties as their keys or values, there is no universal, context-free way to determine the type of the struct.

To that end, this dictionary maps MapProperty names to the type of the structs within them (tuple of key struct type and value struct type) if they are not None-terminated property lists.

public Dictionary<string, Tuple<FString, FString>> MapStructTypeOverride;

ArrayStructTypeOverride

IN ENGINE VERSIONS BEFORE ObjectVersion.VER_UE4_INNER_ARRAY_TAG_INFO:

In ArrayProperties that have StructProperties as their keys or values, there is no universal, context-free way to determine the type of the struct. To that end, this dictionary maps ArrayProperty names to the type of the structs within them.

public Dictionary<string, FString> ArrayStructTypeOverride;

Properties

PackageFlags

The flags for this package.

public EPackageFlags PackageFlags { get; set; }

Property Value

EPackageFlags

HasUnversionedProperties

Whether or not this asset uses unversioned properties.

public bool HasUnversionedProperties { get; }

Property Value

Boolean

Methods

FixNameMapLookupIfNeeded()

internal void FixNameMapLookupIfNeeded()

GetNameMapIndexList()

Returns the name map as a read-only list of FStrings.

public IReadOnlyList<FString> GetNameMapIndexList()

Returns

IReadOnlyList<FString>
The name map as a read-only list of FStrings.

ClearNameIndexList()

Clears the name map. This method should be used with extreme caution, as it may break unparsed references to the name map.

public void ClearNameIndexList()

SetNameReference(Int32, FString)

Replaces a value in the name map at a particular index.

public void SetNameReference(int index, FString value)

Parameters

index Int32
The index to overwrite in the name map.

value FString
The value that will be replaced in the name map.

GetNameReference(Int32)

Gets a value in the name map at a particular index.

public FString GetNameReference(int index)

Parameters

index Int32
The index to return the value at.

Returns

FString
The value at the index provided.

GetNameReferenceWithoutZero(Int32)

Gets a value in the name map at a particular index, but with the index zero being treated as if it is not valid.

public FString GetNameReferenceWithoutZero(int index)

Parameters

index Int32
The index to return the value at.

Returns

FString
The value at the index provided.

ContainsNameReference(FString)

Checks whether or not the value exists in the name map.

public bool ContainsNameReference(FString search)

Parameters

search FString
The value to search the name map for.

Returns

Boolean
true if the value appears in the name map, otherwise false.

SearchNameReference(FString)

Searches the name map for a particular value.

public int SearchNameReference(FString search)

Parameters

search FString
The value to search the name map for.

Returns

Int32
The index at which the value appears in the name map.

Exceptions

NameMapOutOfRangeException
Thrown when the value provided does not appear in the name map.

AddNameReference(FString, Boolean)

Adds a new value to the name map.

public int AddNameReference(FString name, bool forceAddDuplicates)

Parameters

name FString
The value to add to the name map.

forceAddDuplicates Boolean
Whether or not to add a new entry if the value provided already exists in the name map.

Returns

Int32
The index of the new value in the name map. If the value already existed in the name map beforehand, that index will be returned instead.

Exceptions

ArgumentException
Thrown when forceAddDuplicates is false and the value provided is null or empty.

PathToStream(String)

Creates a MemoryStream from an asset path.

public MemoryStream PathToStream(string p)

Parameters

p String
The path to the input file.

Returns

MemoryStream
A new MemoryStream that stores the binary data of the input file.

PathToReader(String)

Creates a BinaryReader from an asset path.

public AssetBinaryReader PathToReader(string p)

Parameters

p String
The path to the input file.

Returns

AssetBinaryReader
A new BinaryReader that stores the binary data of the input file.

GetClassExport()

Searches for and returns this asset's ClassExport, if one exists.

public ClassExport GetClassExport()

Returns

ClassExport
The asset's ClassExport if one exists, otherwise null.

GetParentClass(FName&, FName&)

Finds the class path and export name of the SuperStruct of this asset, if it exists.

public void GetParentClass(FName& parentClassPath, FName& parentClassExportName)

Parameters

parentClassPath FName&
The class path of the SuperStruct of this asset, if it exists.

parentClassExportName FName&
The export name of the SuperStruct of this asset, if it exists.

GetParentClassExportName()

internal FName GetParentClassExportName()

Returns

FName

ResolveAncestries()

Resolves the ancestry of all properties present in this asset.

public void ResolveAncestries()

SetEngineVersion(EngineVersion)

Sets the version of the Unreal Engine to use in serialization.

public void SetEngineVersion(EngineVersion newVersion)

Parameters

newVersion EngineVersion
The new version of the Unreal Engine to use in serialization.

Exceptions

InvalidOperationException
Thrown when an invalid UE4Version is specified.

GetEngineVersion(ObjectVersion, ObjectVersionUE5, List<CustomVersion>)

public static EngineVersion GetEngineVersion(ObjectVersion objectVersion, ObjectVersionUE5 objectVersionUE5, List<CustomVersion> customVersionContainer)

Parameters

objectVersion ObjectVersion

objectVersionUE5 ObjectVersionUE5

customVersionContainer List<CustomVersion>

Returns

EngineVersion

GetEngineVersion()

Estimates the retail version of the Unreal Engine based on the object and custom versions.

public EngineVersion GetEngineVersion()

Returns

EngineVersion
The estimated retail version of the Unreal Engine.

GetCustomVersion(Guid)

Fetches the version of a custom version in this asset.

public int GetCustomVersion(Guid key)

Parameters

key Guid
The GUID of the custom version to retrieve.

Returns

Int32
The version of the retrieved custom version.

GetCustomVersion(String)

Fetches the version of a custom version in this asset.

public int GetCustomVersion(string friendlyName)

Parameters

friendlyName String
The friendly name of the custom version to retrieve.

Returns

Int32
The version of the retrieved custom version.

GetCustomVersion<T>()

Fetches a custom version's enum value based off of its type.

public T GetCustomVersion<T>()

Type Parameters

T
The enum type of the custom version to retrieve.

Returns

T
The enum value of the requested custom version.

Exceptions

ArgumentException
Thrown when T is not an enumerated type.

GuessCustomVersionFromTypeAndEngineVersion(EngineVersion, Type)

public static int GuessCustomVersionFromTypeAndEngineVersion(EngineVersion chosenVersion, Type typ)

Parameters

chosenVersion EngineVersion

typ Type

Returns

Int32

GetDefaultCustomVersionContainer(EngineVersion)

Fetches a list of all default custom versions for a specific Unreal version.

public static List<CustomVersion> GetDefaultCustomVersionContainer(EngineVersion chosenVersion)

Parameters

chosenVersion EngineVersion
The version of the engine to check against.

Returns

List<CustomVersion>
A list of all the default custom version values for the given engine version.

ConvertExportToChildExportAndRead(AssetBinaryReader, Int32)

protected void ConvertExportToChildExportAndRead(AssetBinaryReader reader, int i)

Parameters

reader AssetBinaryReader

i Int32

Read(AssetBinaryReader, Int32[], Int32[])

Reads an asset into memory.

public void Read(AssetBinaryReader reader, Int32[] manualSkips, Int32[] forceReads)

Parameters

reader AssetBinaryReader
The input reader.

manualSkips Int32[]
An array of export indexes to skip parsing. For most applications, this should be left blank.

forceReads Int32[]
An array of export indexes that must be read, overriding entries in the manualSkips parameter. For most applications, this should be left blank.

Exceptions

UnknownEngineVersionException
Thrown when this is an unversioned asset and is unspecified.

FormatException
Throw when the asset cannot be parsed correctly.

WriteData()

Serializes an asset from memory.

public MemoryStream WriteData()

Returns

MemoryStream
A stream that the asset has been serialized to.

Write(String)

Serializes and writes an asset to disk from memory.

public void Write(string outputPath)

Parameters

outputPath String
The path on disk to write the asset to.

Exceptions

UnknownEngineVersionException
Thrown when is unspecified.