Plant fungus, and the moist conditions that facilitate fungal growth, attracts fungus gnats. You may easily notice these small gnats flying around your potted plants. Gnats can be much more than a mere nuisance. Gnat larvae in the soil may consume the plant's roots, killing the plant.
Many kinds of fungi can live in plant soil or on the plant itself. Fungus on the plant usually causes discoloration or spots on the leaves. Plants infected with powdery mildew will have a dusty white coating on foliage. Fungus in the soil may appear white, yellow, black or brown. Adult fungus gnats are very small, dark winged insects. Larvae are pale and look like small maggots.
Plants typically acquire gnats from other infected plants. Wet soil contributes to fungus, and both moisture and fungus provide an enticing environment for the gnats' survival. Gnats can occur with or without fungus on or around the plant, but fungus provides extra food for them.
Gnats become a big problem for plants if the larvae start to feast on the plant root system. This will, of course, eventually kill the plant. According to Texas Agricultural Extension Services, gnat larvae may also spread diseases from plant to plant.
If a gnat infestation is already severe, get rid of the infested plants, if possible. In cases where you really want to keep the plant (if it was expensive, for example) you can use pesticides against the gnats. You will have to treat both the soil and the foliage, however, to get rid of them completely. According to Texas Agricultural Extension Service, beneficial nematodes may be added to the soil, if you don't wish to use chemical pesticides in the soil. The foliage can be sprayed with pesticides to kill the adult gnats. Alternatively, for potted plants, you can allow the soil to dry out as much as is possible without harming the plant, ideally about two weeks, according to Denver Plants.
Treat plant fungus as soon as it is spotted and take preventive measures, such as moving the plants to a less crowded, less humid location, to prevent fungus from returning. Texas Agricultural Extension Service recommends removing dead debris from plants and avoiding over watering. In addition, they advise that potting soil containing fresher compost may attract more gnats than aged compost.