Time for action – Setting up a twofer
Another obvious error, with a twist!
Let's rewrite our
PostBeginPlay
function:simulated function PostBeginPlay() { var int AnotherInt; AnotherInt = class'UTGame'.default.CountDown; }
Looks fine this time, we have our brackets, parentheses, and semicolons in place. What could go wrong?
[0003.93] Log: R:\UDK\UDK-AwesomeGame\Development\Src\BrokenGame\Classes\BrokenActor.uc(8) : Error, Instance variables are only allowed at class scope (use 'local'?)
Oh, right. Inside functions we're only allowed to use local variables. Let's fix that real quick:
simulated function PostBeginPlay() { local int AnotherInt; AnotherInt = class'UTGame'.default.CountDown; }
Now it should work, so let's compile it:
[0004.08] Log: R:\UDK\UDK-AwesomeGame\Development\Src\BrokenGame\Classes\BrokenActor.uc(10) : Warning, 'AnotherInt' : unused local variable
Well this is new, a warning this time instead of an error! Unused local variable. We're assigning a value to it, but...