90% of the time, if you see a shiny slightly rounded engagement dog, you can replace that gear, the one the dog mates with, along with that specific shift fork, replace these items with new oem items, and given that everything is assembled as per your manual you will once again have a functioning transmission.
Read no further if rebuilding a stock transmission seems like a stretch.
What I have found is when gears get more room to travel axially along the gear shaft the ability for the gear to stay engaged on its dog gets reduced. Most good transmission shops (R&D transmission in Clearwater, FL) can sell you hardened shims for setting axial freeplay. I have also had to bend shift forks to get the gear to go exactly where I want it to go, not where the shift drum thinks it should go.
Check the bearing bosses on the sides of the cases where the gear can thrust against the case before sucking into the dog. Yamaha used to axially locate the thrust by using a circlip on the countershaft. I remember grinding that groove into new style c/s's to get positive axial clearance.
Transmissions are fun and very intuitive. Just follow the load as the transmission has to switch through its gears.