Warnings are very, very important in any compiled language: they tell you that the computer has checked your code and realised you “probably” created a bug; they even tell you something about what the bug might be.
..but the computer isn’t sure – if it could be sure, it would be a compiler Error (in red). So (in Unity) it’s yellow, and “optional”. But in those cases where it’s not a bug – and you know it! – it’s very annoying. Most IDE’s let you turn them on and off, Unity doesn’t … here’s how to fix it.