Synthesizes trehalose 6-phosphate, the precursor for the production of trehalose, the main carbohydrate storage reserve of the dormant spore. Trehalose accumulates in both prestalk and prespore cells and then is rapidly metabolized during terminal differentiation of stalk cells, while being stored in spores, where it serves as the principal energy and carbon source for germination. D-glucose 6-phosphate + UDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + H(+) + UDP In the N-terminal section; belongs to the glycosyltransferase 20 family. In the C-terminal section; belongs to the trehalose phosphatase family.