I had the same issue as well. My Mac, iPhone and iPad are on the same WiFi network. Bluetooth is not enabled on any of the devices. No generated code is shown on my Mac or iPad when turning on Settings -> Messages -> Text Message Forwarding on my iPhone.
I did notice that only my email address was shown in the Settings -> Message -> Send & Receive on my iPhone. Not my phone number. So, my question was; how do I register my phone number to Messages? After some long investigation I found the following this solution:
On your iPhone:
1 - Turn OFF Messages via Settings -> Messages -> iMessage
2 - Open the Message app
3 - Send a regular SMS text message to your own phone number. Tip: Make it a text that makes you smile ;-)
4 - Turn ON Messages via Settings -> Messages -> iMessage
5 - Exit Settings and close all open apps, including Messages and Settings.
6 - Go back into Settings -> Message -> Send & Receive and verify that your phone number is added to the lists "You can be reached by iMessage at" and "Start new conversation from"
7 - Go to Settings -> Messages -> Text Message Forwarding and enable the message forwarding.
Now you should receive a generated code on your Mac, iPad, etc and be able to enable Text Message Forwarding.
For you, my two cents. Hope this helps :-)
Cheers, Dennis
www.idemi.nl