Android UnityPlayerActivity Action Bar

前端 未结 3 793
逝去的感伤
逝去的感伤 2021-02-05 18:44

I am building an Android application which includes a Unity 3d interactive experience.

I have imported the Unity project into Android Studio but when launched the activ

3条回答
  •  感动是毒
    2021-02-05 19:35

    for Unity version 5.5 best way to avoid Immersive Mode in Android is to pass in the constructor not an Activity but to cast of the ApplicationContext to the Wrapper Context.

    mUnityPlayer = new UnityPlayer((ContextWrapper) getApplicationContext());
    

    That works because in the obfuscated UnityPlayer.class (in unity-classes.jar) there is a check of instance.

     private void h() {
         if(this.h instanceof Activity) {
            ((Activity)this.h).getWindow().setFlags(1024, 1024);
         }
     }
    

    So if it's not an Activity the UnityPlayer.class doesn't set the flag.

提交回复
热议问题