I'm a doctor, not a mechanic

UE2:Factory (UT2004)

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 08:38, 1 June 2009 by Wormbo (Talk | contribs) (Created page with '{{infobox class | package = Core | nativeonly = yes | parent1 = Object }} The base class for UnrealEd factory classes. Factory classes are used to import resources from text ...')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2004 Object >> Factory (native-only)
Package: 
Core

The base class for UnrealEd factory classes. Factory classes are used to import resources from text (e.g. UnrealScript classes from UC files or StaticMeshes from ASE files) or binary files (textures, sounds, meshes) or to create them from scratch. (e.g. classes via the Actor Browser or procedural textures)

Using factories

In most cases you won't come in contact with factory classes directly. UnrealEd uses them internally to import and create various things. Have a look into the log window if you want to see how and when the various factory classes are used.

Some factories aren't exposed in UnrealEd and there is no "wrapper command" for use in #exec directives. The single most prominent example is the TrueTypeFontFactory, but the third-party plugin UFontMaterial provides a custom wrapper that can be invoked via UnrealEd's New Material dialog.

When using #exec directives, you can use any factory directly:

#exec new FactoryName [package=PackageName] [file=FileName] [name=TargetName] [CustomParameter=Value [...]]

The package parameter specifies the target package. It is mandatory when used from the editor console, but optional when used in an #exec directive and defaults to the compiled class's package in that case. The file parameter may not be applicable to all factories (e.g. the TrueTypeFontFactory doesn't use it), but if a file is specified and there's no name parameter, the import name is generated from the specified file name without directory or extension.

Note, that most factories can be used indirectly through other, more flexible import commands. These are listed in the article about #exec directives.

See also