Actor
Object >> Actor |
This article related to UnrealScript or the UnrealScript API is a stub. You can help Unreal Wiki by expanding it. |
Actor is the parent class of all objects that have a co-ordinate position in the world. The Actor can move around, interact with other actors, and affect the environment.
Properties
Owner
Tag
Level
Functions
Spawn
The Spawn() function is best described by its UE3 declaration:
(The last two parameters do not exist in earlier engine generations.)
All except the first parameter are optional. The function is not static, so you always need some actor reference to create other actors.
You may have noticed the keyword coerce in that unusual place already. It points out that the compile-time return type of the Spawn() function corresponds to the metaclass of the first parameter's type. Consider the following UT3-based examples: <uscript> local class<UTHud> UHClass; local class<Hud> HClass; local Hud H; local UTHud UH;
UHClass = class'UTHud'; HClass = class'UTHud';
UH = Spawn(class'UTHud'); // works because UTHud extends Hud UH = Spawn(UHClass); // works because the metaclass of UHClass is UTHud H = Spawn(UHClass); // works because UTHud extends Hud H = Spawn(HClass); // works because the metaclass of HClass is Hud UH = Spawn(HClass); // type mismatch error (Hud doesn't extend UTHud!) </uscript> The native code behind the Spawn() function causes several UnrealScript functions to be called on the newly created actor (and possibly also on other actors) before it returns the new actor. See What happens when an Actor is spawned for details.
To create non-actor objects, use the operator New instead.