It often depends mostly on schedule constraints and what are you going to do with the code. If you're writting one-offs(which many would argue aren't existing anyway) I think unit tests are not needed.
However if you're writting a modular software that will be potentially re-used or re-factored in the future - unit tests are very helpful.
I often find the main purpose of them not to determine bugs in current implementation but to insure that no bugs introduced when changes arrive.