Mating systems, that is, whether organisms give rise to progeny by selfing, inbreeding or outcrossing, strongly affect important ecological and evolutionary processes. Large variations in mating systems exist in fungi, allowing the study of their origin and consequences. In fungi, sexual incompatibility is determined by molecular recognition mechanisms, controlled by a single mating-type locus in most unifactorial fungi. In Basidiomycete fungi, however, which include rusts, smuts and mushrooms, a system has evolved in which incompatibility is controlled by two unlinked loci. This bifactorial system probably evolved from a unifactorial system. Multiple independent transitions back to a unifactorial system occurred. It is still unclear what force drove evolution and maintenance of these contrasting inheritance patterns that determine mating compatibility. Here, we give an overview of the evolutionary factors that might have driven the evolution of bifactoriality from a unifactorial system and the transitions back to unifactoriality. Bifactoriality most likely evolved for selfing avoidance. Subsequently, multiallelism at mating-type loci evolved through negative frequency-dependent selection by increasing the chance to find a compatible mate. Unifactoriality then evolved back in some species, possibly because either selfing was favoured or for increasing the chance to find a compatible mate in species with few alleles. Owing to the existence of closely related unifactorial and bifactorial species and the increasing knowledge of the genetic systems of the different mechanisms, Basidiomycetes provide an excellent model for studying the different forces that shape breeding systems.