So this is weird but I have a null pointer error that I cannot find because it doesn’t appear to occur when using the debugger or when debug logging with if statements or anything.
It is in
NeoFPS\Core\Weapons\ModularFirearm\Shooters\HitscanShooter.cs
line 151
effect.Hit(m_Hit, newRayDirection, m_Hit.distance, float.PositiveInfinity, firearm as IDamageSource);
and/or 157
effect.Hit(m_Hit, ray.direction, m_Hit.distance, float.PositiveInfinity, firearm as IDamageSource);
I have checked the variables effect and all parameters passed multiple times now but none of them are null. Debug logging them never prints null and neither with a breakpoint. I am even able to break in the Hit function.
I am also able to get into the Hit function being executed and nothing appears to be null there either except for maybe collider, but commenting out the code doesn’t help. I already commented out the whole function contents and it keeps throwing the errors at lines 151/157
Even put a catch around it
catch (System.Exception e)
{
Debug.Log(effect);
Debug.Log(hitPoint);
Debug.Log(firearm);
}
But it logs them just fine? huh?
Any other ways I could figure out what is going on because it appears as if nothing is null and there should not be an exception.
I can’t really see any way to break on exception (as you could with PHP for example)