I think you did the right thing. Punishment and negative associations with toilet habits is a no no for me as it can lead to them hanging on too long and all sorts of baldder and urinary tract issues. At that age the emabrrassment of having done it is usually enough of a punishment.

When DD needs to go and we are at the park she has the choice to leave or wee on the grass - she generally wees on the grass The desire to play is always going to override the toilet.