- Home /
 
Hide/Show status bar Android/iOS on Runtime
I tried to use
 UnityEditor.PlayerSettings.statusBarHidden = true;
 
               but not working cuz it's a UnityEditor namespace which does not allow Android build
is there any other way to access the status bar thing for both Android and iOS
even Rather than writing a plugin, please ??
Answer by Johannski · Jan 10, 2018 at 05:30 PM
Take a look at this repo: https://github.com/HuaYe1975/UnityStatusBarForiOS
They somehow override functionality from #include "UnityViewControllerBaseiOS.h" if I got it right. Tested it with iOS 11, Unity 5.6.4p4 and Xcode9 and it works like a charm with that setup. If you use Unity 2017 or higher you will need to replace #include "UnityViewControllerBaseiOS.h" with #include "UnityViewControllerBase.h" in StatusBarViewController.mm.
Answer by nonehill · Mar 17, 2016 at 03:20 PM
create class in xcode and paste following code. than use it in unity project
 #import "StatusBar.h"
 
 @implementation StatusBar
   + (void) hideStatusBar: (BOOL)hide
     {
         [[UIApplication sharedApplication] setStatusBarHidden: hide
                                                 withAnimation: UIStatusBarAnimationSlide];
         [UnityGetGLViewController() setNeedsStatusBarAppearanceUpdate];
     }
     
     @end
     
     extern "C"
     {
         void StatusBarSwitcherPressed(bool isHide)
         {
             [StatusBar hideStatusBar: isHide];
         }
     }
 
              Would you might give some more detail how this works? I was getting error by unable to fine "#import "StatusBar.h"", many thanks!
@ToxinHeart - Did you get this to work? I am also looking for a solution for this :-/
Answer by SaariTech · Mar 06, 2021 at 11:24 PM
Hi guys,
I made a asset for this, it is possible to have a toggleable full screen mode.
Your answer