In a medium skillet over medium heat cook butter and sugar until butter is melted and sugar is dissolved. Stir cornstarch into water and pour into sugar mixture a little at a time, cooking and stirring until mixture thickens. Remove from heat and stir in vanilla.