Here's a diagram of your shift shaft.
Something is bent, broken or loose causing your problem as it's straightforward mechanicals with no electrical or anything like that involved. Also, this can be worked on without removing the engine or splitting the cases. Look at the parts closely and see if you can see where it is hanging up. Perhaps you could take a hi res photo and post it.
The long shaft goes through the engine and turns the shift drum via a star shaped part behind a case on the right side of the bike. That could be also where it's hung up.
It's not likely internal to the transmission from your description of events. The shift mechanism is one of the easiest to access if you're handy with tools, but have it looked at by a mechanic if you aren't comfortable taking it apart.