Why did the Spanish Colonies in the Americas not unite after becoming independent?

by randomhistorian1

When the Portuguese and British colonies in the Americas became independent they stayed united or united after independence, with the 13 British colonies uniting and forming the USA and the Portugese colony in South America becoming the independent Empire of Brazil. This did not happen however when the Spanish colonies achieved independence, with the Spanish Americas dissolving into a number of different states. Why did this happen? Also was there any attempt to unite the different states, and if not why was there no such attempt?

dominnic