Why does an ecosystem need a continuous supply of sunlight?

Sunlight is the primary source of energy for producers (plants) to perform photosynthesis, which is the base of the food chain.