Quantcast
Channel: Programming (In-game)
Viewing all articles
Browse latest Browse all 645

Block.GetValue("IsShooting") nullreference error

$
0
0
Hi,
Does anyone have an idea, why this is always throwing an exception ?

Code:
int firingguns = 0;
List<IMyTerminalBlock> Guns = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyUserControllableGun>(Guns);
for(byte i=0;i<Guns.Count;i++)
{
	if( Guns[i].GetValue<bool>("IsShooting")==true )  firingguns += 1;
}

I checked every part of this code and only this part seems to cause the problem:
"GetValue<bool>("IsShooting")"...

Block.GetValue<bool>("IsShooting") nullreference error

Viewing all articles
Browse latest Browse all 645

Trending Articles