I am facing this problem ever since I started using Ubuntu 6 years back.
If I leave the laptop unused for more than 5 hours or so all my WiFi networks disappear and I have to reboot to bring them back.
Also if I switch on a WiFi network never before used, then it takes a reboot for the network to be detected.
I have no idea why is it like this?
The solution which works sometimes is disabling WiFi, disabling networking and then re-enabling networking and re-enabling WiFi. But it doesn't always work.
Other than Ubuntu in other Debian based OS's like Linux Mint, Kali Linux and Debian even this doesn't work and reboot is the only option.
The question is related to Ubuntu only. Just for the sake of information I mentioned the status with the other three OS's.
Here is the wireless script link: http://pastebin.com/aA00TCWR