Time for action – Breaking some more code
Let's take a look at two more common errors when working with UnrealScript. We'll add a bit more to our BrokenActor
.
Let's change our
BrokenActor
to look like this:class BrokenActor extends Actor placeable; var int MyInt; simulated function PostBeginPlay() { if(MyInt > 5) { `log("MyInt is greater than 5! MyInt is:" @ MyInt); } else { `log("MyInt is less than or equal to 5! MyInt is:" @ MyInt); } defaultproperties { MyInt=13 Begin Object Class=SpriteComponent Name=Sprite Sprite=Texture2D'EditorMaterials.TargetIcon' Scale=0.35 HiddenGame=true End Object Components.Add(Sprite) }
Compile the code. We'll see this error pop up:
[0003.94] Log: R:\UDK\UDK-AwesomeGame\Development\Src\BrokenGame\Classes\BrokenActor.uc(13) : Error, Unexpected end of file at end of Class
Whenever this error shows up, it means we've missed a closing } bracket somewhere. In this case, we haven...