Time for action – Dealing with Accessed None
To test this we need to purposely create an Accessed None, so let's do that now. We'll add a PostBeginPlay
function to our BrokenActor
.
Let's say we wanted to know the speed of a Projectile. We could add a variable and write a function like this in our
PostBeginPlay
:var Projectile MyProjectile; simulated function PostBeginPlay() { local float ProjectileSpeed; ProjectileSpeed = MyProjectile.Speed; `log("ProjectileSpeed:" @ ProjectileSpeed); }
Compile the code and run the game.
Exit the game and check the log:
[0004.99] ScriptWarning: Accessed None 'P' BrokenActor BrokenMap.TheWorld:PersistentLevel.BrokenActor_0 Function BrokenGame.BrokenActor:PostBeginPlay:004F [0004.99] ScriptLog: ProjectileSpeed: 0.0000
We're getting an Accessed None warning and the speed is logging as 0. That doesn't seem right, especially when the default for the
Projectile
class is 2000. Let's add another log to see what's going on:var Projectile MyProjectile; ...