Time for action – All classes are created equally
What does this mean for us in practical terms? Let's take a look at our friend AwesomeActor to see if he can help demonstrate.
Write the following code in our
AwesomeActor
class:class AwesomeActor extends Actor placeable; var() int MyInt; function PostBeginPlay() { `log(self @ MyInt); } defaultproperties { MyInt=4 Begin Object Class=SpriteComponent Name=Sprite Sprite=Texture2D'EditorResources.S_NavP' HiddenGame=True End Object Components.Add(Sprite) }
We'll use an editable
MyInt
variable to see class behavior.Compile the class and open up the editor. Next to our existing
AwesomeActor
, place another one.Save the map and run it from the editor, then close out the game and editor.
Now let's take a look at our
Launch2.log
file:[0010.61] ScriptLog: AwesomeActor_0 4 [0010.61] ScriptLog: AwesomeActor_1 4
We can see that class instances are created with the class name and then a number added to the end. Remembering...