In the fungus Ustilago maydis, the ability to distinguish between partners that are of the same or of different mating type is controlled by two mating-type loci. One locus allows extracellular recognition though a pheromone-based system. After cell fusion, the other mating-type locus, which exists in multiple alleles, determines intracellular recognition. Each allele encodes a pair of homeodomain proteins that are active only in pairwise combinations in which the two partners originate from different alleles of the locus. Recent discoveries suggest that the underlying molecular recognition mechanism is the ability to form heterodimers. Whereas the proteins in all different allelic combinations interact, it is a specific feature of proteins from the same allele not to interact. This suggests the existence of a code for protein-protein recognition.