Hi,
Does anyone have an idea, why this is always throwing an exception ?
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
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