Essential role of autophagy in resource allocation during sexual reproduction