It's to your advantage to resolve custody issues outside of a courtroom environment. If you don't, a judge will have to decide what's best. That means major decisions about your children's future and well-being is in the hands of a third party, and you might not like the outcome. If you are able to reach a decision together with your spouse, the Court will approve it as long as it's reasonable. This approach actually gives you more control over the final custody arrangement you'll both be living with.
If you litigate, the Court may appoint an attorney to represent your children, whom you will have to pay in addition to your own lawyer. The cost can be significant, even if you're splitting it with your spouse. This attorney will interview your spouse and you, and may recommend that the Court obtain various expert opinions. The Court will probably order these, and you will have to pay for them too. The judge will rely heavily on the reports and conclusions of these experts in reaching a decision.
You'll find fighting about custody in Court to be just about the nastiest and most upsetting experience you've ever had. Your spouse's attorney will attempt to make you look bad, and your spouse appear as the more fit parent. All your bad points will be brought up for scrutiny, presented in the worst possible context. On top of this, you'll be paying expensive legal fees for the whole experience.
In dealing with your spouse, the attitude you begin with establishes the tone of your discussions and future events. Keep in mind that when there is a custody fight, everything else in the divorce tends to be contested.