The term subobject refers to a special kind of object and its textual definition in a defaultproperties block of a class. Depending on the context, a subobject can either be a template or an actual object. In Unreal Engine 3 they are generally templates (actually archetypes), while in Unreal Engine 2 subobjects are generally actual objects unless their class is declared with the class modifier "instanced", which applies to all GUI subclasses in UT2003 and UT2004. There is no support for subobjects in Unreal Engine 1.
Subobjects that are only templates are "instanced" (i.e. created) when an object of the class containing the subobject definition is created. Generally, the property Outer of an instanced subobject points to the containing object, while the Outer property of "actual object" subobjects points to the class defining the subobject. An example for the latter case is the UT200x class xEffects.Shark, which creates a FinalBlend as a subobject and uses it as Skin.
To define a subobject, add the following to the defaultproperties block of your class:
Begin Object Name=objectname Class=classname subobject properties End Object
For the subobject properties the same syntax and rules apply as for the defaultproperties block itself.
The Class=… part is optional in Unreal Engine 3. Omitting it means that you want to duplicate a subobject with the same name defined in a parent class.
Subobjects in exported source code
Subobject definitions may not get exported at all in early Unreal Engine 2 implementations. In newer versions subobjects will only be exported if they are either assigned to at least one property declared with the modifier export or if a property they are assigned to is of a type that is declared as instanced. For example a tooltip object assigned to the GUIComponent.ToolTip property would get exported because the property's type is GUIToolTip, a subclass of GUI, which is declared with the instanced class modifier. Any karma parameter subobject assigned to the Actor.KParams property would be exported because that property is declared with the export variable modifier.
Subobjects in Unreal Engine 3 are only exported if the subobject's class is a subclass of Component. A prominent example of this behavior is the UIObject class. Its subobject WidgetInitializedEvent is not exported because it's a UIEvent_Initialized, which is not a Component subclass, while its other subobject WidgetEventComponent (class UIComp_Event) is exported.
Note: UT3 adds illegal syntax elements to exported subobjects. Your subobject definition should not have an ObjName=… or Archetype=… clause in its Begin Object line and neither should it define values for the Name or ObjectArchetype properties in the subobject body.
As you can see, it's always a good idea to have a look at the original (downloaded, not exported) sources if you want to find out about subobject usage.
|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|