No, though that is the easiest way to generate electricity. As long as the sun is out, even if you can’t see it yourself, your solar panels will be working.