Organisms with simpler organisation, like fungi and algae switch to sexual mode of reproduction just before the onset of adverse conditions because sexual reproduction would bring variation into the organisms and some variants might be able to survive in unfavourable condition.