The code hitThing is Pawn hitPawn in the if statement of the Impact override causes the following exception in Rimworld. I used Visual Studio Community 2019 as my compiler.
Exception ticking Bullet_PlagueGun46757: System.NullReferenceException: Object reference not set to an instance of an object at Plague.Projectile_PlagueBullet.Impact (Verse.Thing hitThing) [0x00000] in <filename unknown>:0 at Verse.Projectile.ImpactSomething () [0x00000] in <filename unknown>:0 at Verse.Projectile.Tick () [0x00000] in <filename unknown>:0 at Verse.TickList.Tick () [0x00000] in <filename unknown>:0 Verse.Log:Error(String, Boolean) Verse.TickList:Tick() Verse.TickManager:DoSingleTick() Verse.TickManager:TickManagerUpdate() Verse.Game:UpdatePlay() Verse.Root_Play:Update()
The error can be fixed by adding a new if statement to check if the hitThing is a Pawn, like if (hitThing is Pawn) and putting the rest of the code for Impact inside the block.
The code
hitThing is Pawn hitPawn
in the if statement of the Impact override causes the following exception in Rimworld. I used Visual Studio Community 2019 as my compiler.Exception ticking Bullet_PlagueGun46757: System.NullReferenceException: Object reference not set to an instance of an object at Plague.Projectile_PlagueBullet.Impact (Verse.Thing hitThing) [0x00000] in <filename unknown>:0 at Verse.Projectile.ImpactSomething () [0x00000] in <filename unknown>:0 at Verse.Projectile.Tick () [0x00000] in <filename unknown>:0 at Verse.TickList.Tick () [0x00000] in <filename unknown>:0 Verse.Log:Error(String, Boolean) Verse.TickList:Tick() Verse.TickManager:DoSingleTick() Verse.TickManager:TickManagerUpdate() Verse.Game:UpdatePlay() Verse.Root_Play:Update()
The error can be fixed by adding a new if statement to check if the
hitThing
is a Pawn, likeif (hitThing is Pawn)
and putting the rest of the code for Impact inside the block.