ãUnityãUnity 5.3以éã§Androidã®Status Barã表示ããæ¹æ³
ãUnity 5.3ã§å人çã«æ°ã«ãªã£ãæ©è½ã¾ã¨ã ãã«æ¸ããéããUnity 5.3ã«ã¦ä½æ ãAndroidã§Status Barã表示ãããªãã·ã§ã³â¦ä¾ãã°status bar hiddenãä¸å使ç¨åºæ¥ãªããªããã¹ãã¼ã¿ã¹ãã¼ã表示ããäºãåºæ¥ãªããªãã¾ããã
ã¹ãã¼ã¿ã¹ãã¼ã表示ããã®ãæè¿ã®ä¸»æµã§ã¯ãªããªã£ã¦ããã¨ã¯è¨ã*1ãçµæ§ãªæ°ã®ã¢ããªãã¹ãã¼ã¿ã¹ãã¼è¡¨ç¤ºãè¡ã£ã¦ããã®ã§ãä¸å¿ããã®åºãæ¹ã«ã¤ãã¦æ¸ãã¦ã§ãã
- Androidã§ã¹ãã¼ã¿ã¹ãã¼ã表示ããæ¹æ³
- ã¢ããªèµ·åæã«ã¹ãã¼ã¿ã¹ãã¼ã表示ãã
- Androidã¨iOSã®æ´åæ§
- ã½ã¼ã¹ã³ã¼ã
- é¢é£
Androidã§ã¹ãã¼ã¿ã¹ãã¼ã表示ããæ¹æ³
Androidã§ã¹ãã¼ã¿ã¹ãã¼ã表示ããããã«ãAndroidã®ãã¤ãã£ããªæ©è½ãç´æ¥æä½ãã¾ãããããã使ç¨ãã¦ãè¯ãæ¹æ³ããªã®ãã¯æ£ç´å¾®å¦ãªæã§ãããä¸å¿åãã®ã§ã¾ããèªå·±è²¬ä»»ã§ã*2
ãã®ãã¤ãã£ãã¸ã¢ã¯ã»ã¹ããã³ã¼ããé å¼µã£ã¦æ¸ãã¦ãè¯ãã®ã§ãããæ¢ã«æ©è½ãçºãã¦å ¬éãã¦ããã¦ããã³ã¼ããããã®ã§ããããæåãã¾ãã
ApplicationChrome.csãå°å ¥ãã¦ãã¢ããªã®ä»»æã®ã¿ã¤ãã³ã°ã§ä¸ã®ãããªã³ã¼ããå¼ã¶ã¨ããã®ã¿ã¤ãã³ã°ããã¹ãã¼ã¿ã¹ãã¼ã表示ããã¾ãã
ApplicationChrome.statusBarState = ApplicationChrome.States.Visible;
ã¾ãåç´ã«ã表示ã»é表示ãã ãã§ã¯ãªããè²ãä¸éæã»åéæã®æå®ãå¯è½ã¿ããã§ããåéæã®å ´åãç»é¢ãµã¤ãºãå°ãä¸ã«ä¼¸ã³ãã®ã§ããã®è¾ºã注æã§ãã
ã¤ãã§ã«ApplicationChrome.csã¯ããã²ã¼ã·ã§ã³ãã¼ï¼ç»é¢ä¸ã«è¡¨ç¤ºãããä»®æ³ãã¿ã³ï¼ã®è¡¨ç¤ºã»é表示ã»éæ表示ãªå¶å¾¡ãåºæ¥ãã®ã§ãããã²ã¼ã·ã§ã³ãã¼ãå¿ è¦ãªã¢ããªã±ã¼ã·ã§ã³ã§ãæå¤ã¨éå®ããããããã¾ããã
ã¢ããªèµ·åæã«ã¹ãã¼ã¿ã¹ãã¼ã表示ãã
次ã«ã¢ããªã±ã¼ã·ã§ã³èµ·åæã«ã¹ãã¼ã¿ã¹ãã¼ãæå®ããã¢ããã¼ãã«ã¤ãã¦èãã¦ã¿ã¾ãã
åç´ã«èããã¨ãæåã«èµ·åããéã®ã·ã¼ã³ã«ã¦èªã¿è¾¼ãã¢ããã¼ããèãããã¾ããããã®ã¢ããã¼ãã ã¨æåã®ã·ã¼ã³ã表示ãããå¾ã«ã¹ãã¼ã¿ã¹ãã¼ã表示ããã¾ãã
RuntimeInitializeOnLoadMethodãªãèµ·åæã«ã¡ã½ãããèªãAttributeï¼å±æ§ï¼ãããã¾ããããããåæ§ã«æåã®ã·ã¼ã³ãèªã¾ããå¾ã«ã¹ãã¼ã¿ã¹ãã¼ã表示ããã¾ãã
ããå°ãåã®æ®µéã§èªãã¢ããã¼ãã¨ãã¦ã¯ãScriptableObjectã¨ãã¦ä½æãã¦ãããPreloadObjectã«ç»é²ãOnEnableã§ã¹ãã¼ã¿ã¹ãã¼ã表示ããã¢ããã¼ãã§ãã
ãUnityãã²ã¼ã èµ·åç´å¾ã«1度ã ãå¦çãè¡ã ã®å¿ç¨ã§ãããå°ãã ãåã«ã¹ãã¼ã¿ã¹ãã¼ã表示ããã¾ãã
ããã¾ã§ãããªãActivityæ¸ãæãã¡ããã®ãè¯ããããã¾ãã
ãããã¯ãç¡çã«ã¹ãã¼ã¿ã¹ãã¼ã表示ããããããæ¼åºã§å°ãéãæãããæ¹ãããã¬ã¤ã¤ã¼ã«ã¨ã£ã¦ã¯å¥å
¨ãªãããªæ°ããã¾ãããã©ããªãã§ãããã
Androidã¨iOSã®æ´åæ§
ãã®ã¾ã¾åç´ãªå®è£ ã§ãã¨iOSã¨Androidã®ã¹ãã¼ã¿ã¹ãã¼ãåæ¹è¨å®ããªããã°ãããªãã®ã§ãè¥å¹²ã¯ã¼ã«ã§ã¯ããã¾ããããªã®ã§ãAndroidã§ã¹ãã¼ã¿ã¹ãã¼ã®è¡¨ç¤ºã»é表示ãè¨å®ãããiOSãåæ ãããããã«ãã¦ã¿ã¾ãã*3
å®éã¯ç°ãªããã©ã³ãã§éçºãã¦ããããããã¯ãã©ãããã©ã¼ã åæ¿æã«ä½ããã®å¦çãèµ°ãããã¨æãã®ã§ãä½ãããã«æå³ã¯ç¡ãã¨æãã¾ããä¸å¿ã
ScriptableObjectã§ãã©ã¡ã¼ã¿ãè¨å®ãã¦ããå ´åãScriptableObjectã®ãã©ã¡ã¼ã¿å¤æ´æã«PlayerSettingsãå¤æ´ãã¦ãã¾ãã¾ãã
OnValidate ()ã¯ScriptableObjectã§ãåä½ããã®ã§ããããã£ãã¨ãã«ä¾¿å©ã§ããå¾ã¯UnityEditor.PlayerSettings.statusBarHiddenãUnityEditor.PlayerSettings.iOS.statusBarStyleãOnValidate ()æã«ScriptableObjectã®å¤ã¨ä¸è´ãããããªå½¢ã«å¤ãã¦ãã¾ãã°ãiOSã¨Androidéã§æ´åæ§ã¯åãããã§ãã
ã½ã¼ã¹ã³ã¼ã
è¨å®ãé¢åãããã®ã§ãããã¸ã§ã¯ããã¨å ¬éãã¾ãã
é¢é£
ApplicationChrome.csã®æä¾å
Unity tidbits: changing the visibility of Androidâs navigation and status bars, and implementing immersive mode
*1:確èªãããæè¿ã®ã²ã¼ã ã¯æå¤ã¨ã¹ãã¼ã¿ã¹ãã¼è¡¨ç¤ºãã¦ãªã
*2:Unityå ¬å¼ã§ãµãã¼ãããªããªã£ã以ä¸ãæªãæ¹æ³ã«å½ããã¨ã¯æãã¾ã
*3:çæ³ã§ã¯PlayerSettingsã®å¤ãåããã°è¯ãã®ã§ãããPlayerSettingsã¯UnityEditor以ä¸ã®ã³ã¼ããªã®ã§â¦