The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
A class is a "blueprint" to create objects, which are also called instances of that class.
|Please help improve this article or section by expanding it.
Further information might be found on the talk page.
Class declarations generally look as follows:
class classname extends parentclass [within outerclass] [modifiers] ;
The class name is a standard identifier, which means it must start with a letter or underscore
_, can only contain letters, digits and the underscore character and has a length limit of 63 characters in total. The class name must be unique among all objects (this includes group names and ungrouped resources like textures) within a package. While class names are not required to be unique throughout the engine, it is strongly recommended you do not reuse any existing class names.
The extends clause is mandatory for all classes, except the Object class, which is the root of the class hierarchy and the only class without a parent class. The within clause is optional and available starting with Unreal Engine 2. If specified, instances of this class can only be created within instances of the specified outer class. The class names specified in the extends and within clauses can optionally be qualified with a package name, though this is only necessary if you don't use unique class names.
|The modifier is available in ...|
|Version Tag||Game||Engine Version|
|1||Any Unreal Engine 1 game e.g. UT||Unreal Engine 1|
|2||Any Unreal Engine 2 game e.g. UT2004||Unreal Engine 2|
|3||Any Unreal Engine 3 game e.g. UT3||Unreal Engine 3|
|3-x1||UT3 patch 2.0||Unreal Engine 3|
|3-x2||UDK 2009-12||Unreal Engine 3 - 6000 - present|
|3-x3||UDK 2010-07||Unreal Engine 3 - 6890 - present|
|(lesser than i.e. <)||A specific version e.g. 3 < 3-x2 would mean it's available in Unreal Engine 3 but not anymore since UDK|
|(no number)||all Unreal Engine generations.|
- No instances can be created of this class.
- This class should not be exported to UCL files. Only has an effect for classes that are exported by default.
- Specifies the configuration file name to use for the config and globalconfig variables in this class. This modifier is inherited. Loading and saving configurable variable values only has an effect if the class or one of its parent classes includes this modifier. In Unreal Engine 1 and 2 the special config names System and User are mapped to the system and user INI files, e.g. UnrealTournament.ini or UT2004.ini and User.ini or whatever is specified via the
userini=...command line parameters. Similarly the special config names Editor, EditorUserSettings, Engine, Game, Input, MapLists, UI and Vote are mapped to whatever is specified via the
editorini=..., etc. command line parameters.
- Specifies a class that must be parsed before this one. This is only necessary if the class is in the same package and declares a struct or enum type this class wants to use. Note that parent classes and implemented interfaces are always parsed before child classes. Only one class can be specified in the dependson definition, but you can add multiple dependson definitions per class declaration.
Important: The compiler is quite sensitive to bad dependson definitions. If the compiler gets stuck or crashes at the "Analyzing..." stage, make sure your dependson definitons specify valid class names in the same package and do not create circular dependencies.
- Same as the UE2 version, but allows a list of class names.
- Marks the entire class as deprecated. The compiler will issue a warning if your code uses deprecated classes or instances of them. When saving packages, instances of deprecated classes might not be stored in the package file anymore.
- The guid the class will use that is saved to disk. This was intended to be used with the Component Object Model, and although the IUnknown interface is implemented natively for all UnrealScript classes, this feature was never actually finished.
- This class implements the specified interface. That means the class must implement all functions defined in the interface.
- Subobjects of this class or any subclass act as templates. Whenever instances of the class defining the subobject are created, a duplicate of the subobject is created and assigned to the corresponding properties of the new instance.
- The class has localized members, this is automatic applied in newer engine builds.
- The config file name for this class can be specified at the command line via the parameter
- Each instance of this class has its own section in configuration files. The non-static SaveConfig() function doesn't propagate the instance values to default values.
- Each instance of this class can have its own section in localization files. (In earlier engine generations this is always the case.)
- Instances of this class can safely be replaced by some kind of default instance if a specific instance is unavailable. This is only used for Textures, which are replaced by the default texture if the specific texture object does not exist.
- Transient, NonTransient3
- Whether instances of this class should be marked as "transient". Transient objects can only exist at runtime, but not in package files. This modifier is inherited by subclasses, but it can only be removed from subclasses in Unreal Engine 3 via the nontransient modifier. By default classes are not transient, for obvious reasons.
- AutoCollapseCategories(name,...)3, DontAutoCollapseCategories(name,...)3
- Automatic collapses the specified variable category, categories with no name can be specified by inputting the class's name where the variable is declared in. This is just like CollapseCategories but can specify which category.
- Automatic expands the specified variable category, categories with no name can be specified by inputting the class's name where the variable is declared in.
- ClassGroup(name,...)3 - UDK-2010-11
- Indicates that this class and its subclasses should be shown in the specified groups in the editor's Actor Classes browser when Group View is enabled.
- CollapseCategories2,3, DontCollapseCategories2,3
- Whether to hide variable group headers (i.e. collapse variable groups) in property windows. This modifier is inherited and dontcollapsecategories is the default.
- DontSortCategories(name,...)3 - UDK
- EditInlineNew2,3, NotEditInlineNew2,3
- Whether instances of this class can be created for editable object variables via a button in the properties window. The editor allows you to select a non-abstract editinlinenew class via a drop-down list.
- Forces the property window to display properties from this class in order as declared in the class.
- HideCategories(name,...)2,3, ShowCategories(name,...)2,3
- Whether to hide the specified property groups from property windows. By default all property groups are displayed. The special group name None contains all properties not belonging to any specific group. This special group is only included in the properties window if it was opened via debug console commands from within the game.
- Hide this class from various drop-down lists in the editor, e.g. for properties of type class. UT2004 also provides the static Actor.ShouldBeHidden() function for actor classes that returns whether the class was declared with the hidedropdown modifier.
- Instances of this class can not be created in the editor. Unlike the newer placeable modifier, nousercreate is not inherited.
- Placeable2,3, NotPlaceable2,3
- Whether instances of this class can be created in the editor. This modifier is inherited to subclasses and the default is notplaceable.
Native implementation modifiers
- Enables the DLLBind feature for this class. The class can implement functions that call C functions with the same name in the specified dynamic-link library.
- All structs declared in this non-native class should be exported to native header files. Structs declared in native classes or with the native modifier are also exported without this modifier.
- The native implementation of this class not only inherits from the native implementation of its parent class, but also from the specified C++ class.
- See Native.
- This class contains some kind of native code. A class may only be declared as native if it has a native parent class. A C++ declaration for this class is exported to
packagenameClasses.hat compile time unless the noexport modifier is specified. The exported C++ declaration includes all variables, structs, enums, delegates and any functions declared with the native or event modifier.
- Same as native, except that the native C++ declaration of this class is exported to
- This class cannot contain non-native functions. And other classes cannot access this class's properties. NativeOnly classes cannot extend non-native classes.
- Implies: Native
- The conditions for replicating variables contained in this class are specified in native code. The replication block usually only contains an approximate representation of these conditions so UnrealScript programmers can see what is going on. This does not affect conditions for function replication.
- Prevents exporting headers for this native class. Classes with the noexport modifier use manually created native header files instead.
Native class code
Like native structs, some classes in Unreal Engine 2 and 3 games may contain native code snippets(cpptext) in UnrealScript. These declarations do not affect UnrealScript directly, but they are exported when auto-generating native headers while compiling UnrealScript classes.
|Declarations||Preprocessor • Classes • Interfaces • Cpptext • Constants • Enums • Structs • Variables (Metadata) • Replication block • Operators • Delegates • Functions • States • Defaultproperties (Subobjects)|
|Types||bool • byte • float • int • name • string • Object • Class • Enums • Structs (Vector ⋅ Rotator ⋅ Quat ⋅ Color) • Static arrays • Dynamic arrays • Delegates • Typecasting|
|Literals||Boolean • Float • Integer • Names • Objects (None ⋅ Self) • Vectors • Rotators • Strings|
|Flow||GoTo • If • Assert • Return • Stop • Switch • While • Do...Until • For • ForEach • Break • Continue|
|Specifiers||Super • Global • Static • Default • Const|
|UnrealScript||Syntax • .UC • .UCI • .UPKG • Comments • #directives • Native|