I will add that doing nice things because you want to be perceived as a nice person that does nice things is also a nice thing, even though you are somewhat gratifying your own ego in the process, the net benefit for society, for the world, is a nice thing.
The more nice things you do, the nicer of a person you are.
This also accounts for being good, and being altruistic. The more good you do, the better of a person you are. The more altruism you practice, the more altruistic you are. Even if you are doing them for selfish reasons, what actually matters is the outcome.