by Grawmpy Troll
Checks to see if the phone is in portrait mode (so it won't try to turn off the screen if you're gaming in landscape mode). It uses the proximity sensor to see if you have placed the phone in an area where the proximity between itself and any item is within a couple of cm. If it is, it turns off the screen, saves the current volume levels, and sets all sounds to 0%. When you remove the phone from something close-by and the proximity is more than a couple of cm, the screen is turned back on and all volume levels are reset to previous levels.
v3 ➡ Fixed instability and portrait/landscape mode setting and also problem with resources. Now just sits and waits for the changes to happen.