In a large bowl, whisk together sugar and cornstarch.
Add egg yolks.
Whisk until well combined.
In a medium saucepan, heat milk just until it starts to bubble around the edges.
Whisk hot milk into egg mixture in small amounts to avoid scrambling the eggs.
Return to saucepan.
Cook and stir over medium low heat until thickened, about 5-8 minutes.
Remove from heat.
Whisk in vanilla, butter, and chocolate.
If not using immediately, pour into clean bowl, cover with plastic wrap touching the surface, and refrigerate.