The exception is thrown on the if statement's line. I know for certain that both "block" and "block.GetComponent<BlockHandler>()" aren't null thanks to Debug.Logging them. I know that the null thing is the "surroundings[whatIsDown]", but I'm quite baffled as to why it would throw a NullReferenceException just for accessing a null value in an array and checking if it is, indeed, null. The array is also initialized and usable so that's not it either. Any help?
private void CheckDown()
{
foreach (Transform block in transform)
{
if (block.GetComponent<BlockHandler>().surroundings[whatIsDown] == null)
{
//do stuff
}
}
}