Note: this is for Ubuntu ≤ 17.04, since Ubuntu ≥ 17.10 no longer uses Unity.
If your desktop seems to freeze for more than a few seconds, try
- press together the keys:
Ctrl Alt F1
- login with your username and password, and type
unity & disown
This leaves desktop/apps all as they were while fixing the broken state.
Full desktop reset
Restart the whole Unity desktop (which is like unto logging out and logging in, discarding your current desktop):
service lightdm restart