Null reference error unsolvable

Hi, got this error at runtime
Tried the fixes proposed by others and my scripts/ unity editor are the same as code monkey’s… Also my reference unit is set correctly in the inspector.

The result is the grid visuals are not updated because, if what i believe is right, there’s no unit selected before this code is run… Even if the selected unit is set in the inspector.

Edit FIXED I forgot to put the Grid System Visual single script on my prefab… now everything works.

1 Like

Good job finding that. This is one of the most common sources of Null Reference errors, and with complex scenes, it can be difficult to to track these down, especially if only one object in a large scene had a missing reference.

Privacy & Terms