Vous êtes sur la page 1sur 9

UCLASS

ClassDeclaration
UCLASS()Specifiers
Abstract
AdvancedClassDisplay
AssetRegistrySearchable
AutoCollapseCategories
AutoExpandCategories
Blueprintable
BlueprintType
ClassGroup
CollapseCategories
Config
Const
ConversionRoot
CustomConstructor
DefaultToInstanced
DependsOn
Deprecated
DontAutoCollapseCategories
DontCollapseCategories
EditInlineNew
HeaderGroup
HideCategories
HideDropdown
HideFunctions
Intrinsic
MinimalAPI
NoExport
NonTranisent
NotBlueprintable
NotPlaceable
PerObjectConfig
Placeable
ShowCategories
ShowFunctions
Transient
Within
metaSpecifiers
BlueprintSpawnableComponent
UCLASS
https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Classes/in
dex.html
Class Declaration
The class declaration defines the name of the class, what class it inherits from and, thus,
any functions and variables it inherits, and other engine and editor specific behavior that may
be desired via class specifiers and metadata. The syntax for declaring a class is as follows:

UCLASS([specifier,specifier,...],[meta(key=value,key=value,...)])
classClassName:ParentName
{
GENERATED_UCLASS_BODY()
}

The declaration consists of a standard C++ class declaration for the class. Above the
standard declaration, descriptors such as class specifiers and metadata are passed to the
UCLASS macro. These are used to create the UClass for the class being declared, which can
be thought of as the engine's specialized representation of the class. Also, the
GENERATED_UCLASS_BODY() macro must be placed at the very beginning of the class body.

UCLASS() Specifiers
Abstract
The Abstract class specifier declares the class as an "abstract base class", preventing the
user from adding Actors of this class to the world in Unreal Editor or creating instances of
this class during the game.
This is useful for classes which are not meaningful on their own. For example, the AActor
base class is abstract, while the ATrigger subclass is not abstract - you can place an
instance of the ATrigger class in the world and have it be useful, while an instance of AActor
by itself is not useful.
Example
UCLASS(abstract)
class AActor : UObject
{
...
}

AdvancedClassDisplay
The AdvancedClassDisplay class specifier forces all the properties of the class to only
show in the advanced sections in the Details panel, and hidden from view by default.
You can force individual properties of an advanced class to display normally by using the
SimpleDisplay property specifier when declaring the property.
AssetRegistrySearchable
The AssetRegistrySearchable keyword indicates that this property and its value will be
automatically added to the asset registry for any asset class instances containing this as a
member variable. It is not legal to use on struct properties or parameters.
AutoCollapseCategories
The AutoCollapseCategories class specifier negates the effects for the listed categories
from using the AutoExpandCategories specifier on a parent class.
AutoCollapseCategories=(Category, Category, ...)
AutoExpandCategories
Specifies one or more categories that should be automatically expanded in the Unreal Editor
property window for objects of this class. To auto-expand variables declared with no
category, use the name of the class which declares the variable.
UCLASS(autoexpandcategories=PostProcessVolume)
class APostProcessVolume : public AVolume
{
...
}
AutoExpandCategories=(Category, Category, ...)
Blueprintable
Exposes this class as an acceptable base class for creating blueprints. The default is
NotBlueprintable, unless inherited otherwise. This is inherited by subclasses.
BlueprintType
Exposes this class as a type that can be used for variables in blueprints.
ClassGroup
Indicates that Unreal Editor's Actor Browser should include this class and any subclass of
this class within the specified GroupName when Group View is enabled in the Actor
Browser.
ClassGroup=GroupName
CollapseCategories
Indicates that properties of this class should not be grouped in categories in Unreal Editor
property windows. This keyword is propagated to child classes; however, child classes can
override this flag using the DontCollapseCategories keyword.


Config
Indicates that this class is allowed to store data in a configuration file (.ini). If there are any
configurable variables in the class (declared with the config orglobalconfig variable
specifiers), this specifier causes those variables to be stored in the specified configuration
file inside the ( and ). This flag is propagated to all child classes and cannot be negated, but
child classes can change the .ini file by re-declaring the config keyword and specifying a
different file name. The value of IniName is appended to the game name - minus the "Game"
part - to specify the name of the .ini file to store data in (for instance, in UDKGame
specifying config(Camera) will cause the class to use the UDKCamera.ini file). The keyword
inherit can also be specified as the IniName, which will cause the class to use the same
config file as its parent. Some .ini files exist by default, such as:
Config=Engine: Uses the Engine configuration file, which is the name of your
game followed by Engine.ini. For example, UDKGame's engine configuration file is
named UDKEngine.ini.
Config=Editor: Uses the Editor configuration file, which is the name of your
game followed by Editor.ini. For example, UDKGame's editor configuration file is
named UDKEditor.ini.
Config=Game: Uses the Game configuration file, which is the name of your
game followed by Game.ini. For example, UDKGame's game configuration file is
named UDKGame.ini.
Config=Input: Uses the Input configuration file, which is the name of your
game followed by Input.ini. For example, UDKGame's engine configuration file is
named UDKInput.ini.
Config=FileName
Const
All properties and functions in this class are const and should be exported as const. This flag
is inherited by subclasses.
ConversionRoot
A root convert limits a sub-class to only be able to convert to child classes of the first root
class going up the hierarchy.

CustomConstructor
Prevents automatic generation of the constructor declaration.
DefaultToInstanced
All instances of this class are considered "instanced". Instanced classes (components) are
duplicated upon construction. This flag is inherited by subclasses.
DependsOn
Indicates that ClassName is compiled before this class. ClassName must specify a class in
the same (or a previous) package. Multiple dependency classes can be specified using a
single DependsOn line delimited by commas, or can be specified using a separate DependsOn
line for each class. This is important when a class uses a struct or enum declared in another
class as the compiler only knows what is in the classes it has already compiled.
DependsOn=(ClassName, Classname, ...)
Deprecated
This class is deprecated and objects of this class will not be saved when serializing. This flag
is inherited by subclasses.
DontAutoCollapseCategories
Negates an AutoCollapseCategories keyword for the specified categories inherited from a
parent class.
DontAutoCollapseCategories=(Category, Category, ...)
DontCollapseCategories
Negates a CollapseCatogories keyword inherited from a base class.
EditInlineNew
Indicates that objects of this class can be created from the Unreal Editor property window
(default behavior is that only references to existing objects may be assigned through the
property window). This flag is propagated to all child classes; child classes can override this
flag using the NotEditInlineNew keyword.
HeaderGroup
This keyword is used to set the *classes.h file the current header is included in. This also is
partially responsible for controlling the order that code is generated.
HideCategories
Specifies one or more categories that should be hidden in the Unreal Editor property window
for objects of this class. To hide variables declared with no category, use the name of the
class which declares the variable. This keyword is propagated to child classes.
HideCategories=(Category, Category, ...)
HideDropdown
Prevents this class from showing up in Unreal Editor property window combo boxes.
HideFunctions
Hides the specified function in a property viewer. Usage: hideFunctions=FunctionName or
hideFunctions=(category0, category1, ...)
Intrinsic
Class was declared directly in C++ and has no boilerplate generated by UnrealHeaderTool.
DO NOT USE THIS FLAG ON NEW CLASSES.
MinimalAPI
Causes only the class's type information to be exported for use by other modules. The class
can be cast to, but the functions of the class cannot be called (with the exception of inline
methods). This improves compile times of exporting everything for classes that do not need
all of their functions accessible in other modules.
The RequiredAPI function specifier can be used with individual functions to make them
accessible in other modules. This can be used in combination with the MinimalAPI class
specifier to make the class and a subset of its functions available while still keeping
compile times as low as possible.
NoExport
Indicates that this class's declaration should not be included in the automatically-generated
C++ header file by the header generator. The C++ class declaration must be defined manually
in a separate header file. Only valid for native classes.
DO NOT USE THIS FLAG ON NEW CLASSES.
NonTranisent
Negates a Transient keyword inherited from a base class.
NotBlueprintable
Specifies that this class is NOT an acceptable base class for creating blueprints. The default
is NotBlueprintable, unless inherited otherwise. This is inherited by subclasses.
NotPlaceable
Negates a Placeable keyword inherited from a base class. Indicates that this class may not
be placed into a level, etc. in Unreal Editor.
PerObjectConfig
Configuration information for this class will be stored per object, where each object has a
section in the .ini file named after the object in the format[ObjectName ClassName]. This
keyword is propagated to child classes.
Placeable
Indicates that this class can be created in Unreal Editor and placed into a level, UI scene, or
Blueprint (depending on the class type). This flag is propagated to all child classes; child
classes can override this flag using the NotPlaceable keyword.
ShowCategories
Negates a HideCategories keyword for the specified categories inherited from a base class.
ShowCategories=(Category, Category, ...)
ShowFunctions
Shows the specified function in a property viewer. Usage: showFunctions=FunctionName or
showFunctions=(category0, category1, ...)
Transient
Says "objects belonging to this class should never be saved on disk". Only useful in
conjunction with certain kinds of native classes which are non-persistent by nature, such as
players or windows. This keyword is propagated to child classes; child classes can override
this flag using the NonTransient keyword.
Within
The Within class specifier indicates that objects of this class cannot exist outside of an
instance of ClassName. In order to create an object of this class, you must specify an
instance of ClassName as the Outer object.
Syntax
Within=OuterClassName
Example
UCLASS(Within=PlayerController)
class UPlayerInput : public UObject
{
...
}
meta Specifiers
BlueprintSpawnableComponent
If present, the component class can be spawned by a Blueprint.

Vous aimerez peut-être aussi