Yesterday I suddenly stopped getting my Messages messages on my MacBook Pro. iPhone recipients were not getting them from me, either, but it only showed failed in Msgs for non-iPhone people. Also, there was no change in the name (seems like it was a different color when I wasn't logged in properly). I tried turning Forwarding off and on from my iPhone, but that only brought up the validation code box to input it on the phone, and I never got the validation code at the computer. I tried doing bluetooth linking, but even though they could see each other, the computer and the phone would not connect. I decided to let it go and get back to it another time.
Then suddenly today, I started getting Messages on my computer! For no good reason, either, since I could never validate and the forwarding feature was turned off. I guess it connected my account with my email, or something, as well. In any case I was happy, but that wasn't the end of it.
I opened my computer later in the day, and Messages was jumping up and down in my dock, so I brought it up, and low and behold, there was a validation code!!! Obviously, it was an old one, so after I made sure to cancel and wait until no more popped up (they kept popping up because I kept trying to validate with the previous number, which, of course, wasn't the one it was waiting for), I entered the number and Forwarding is now turned back on. Crazy - a day later!!
In any case, if you aren't seeing the validation code, make sure Messages is open and not hiding behind another window or minimized, and you are logged into your account. May not help everyone, but in this case today, it may have been because Messages was in the background, or maybe it just wasn't working properly yesterday. Who knows.