Over17 / UnityShowAndroidStatusBar

Show Android status bar for applications built with Unity 5.3 and later
MIT License
149 stars 35 forks source link

Beginner struggling to follow instructions #28

Open AnthonyGirdler opened 2 years ago

AnthonyGirdler commented 2 years ago

Hi, I'm building a simple music player to learn the Unity UI. My app has a menu bar near the top that is often covered by different screen configurations with cameras and screen corners. I think if I have the status bar showing, it will move my app down an appropriate amount depending on different devices.

I don't understand most of your instructions.

Usage 1. Add the plugin to your project. You need the manifest and the AAR (Assets/Plugins/Android/AndroidManifest.xml and Assets/Plugins/Android/unityShowAndroidStatusBar.aar)

Where is the plugin exactly? Does it consist of only these 2 files? How do I add these files to my project? So far I've created a folder under Assets called Plugins. I can't add AndroidManifest.xml because it does not have a download option. How do I move this file into my plugins folder ? Once these files are in the plugins folder....does that mean the whole plugin is installed?

2. Please pay attention to the manifest - you may want to use the one provided here or, if you have your own base manifest, please make sure to use com.unity3d.nostatusbar.UnityPlayerActivityStatusBar activity as the MAIN/LAUNCHER one.

What is a manifest and what do I do with it ?

3. If you don't want the status and navigation bars to be translucent, change the theme in manifest from UnityTransparentStatusBarTheme to UnityStatusBarTheme

How do I edit the manifest ?

4. Add Screen.fullScreen = false; to your Start() method if you want the status bar shown on KitKat+ devices

Where do I add this? Do I need to create a script and attach it to a game object ? I'm thinking I make a startManager game object and add a c#script to control stuff like this. Does that sound sensible ?

How to Build 0. Put Unity's classes.jar into src/UnityShowAndroidStatusBar/libs/

Where and what is Unity's classes.jar? Where is src/UnityShowAndroidStatusBar/libs/? I normally build the app my making an app bundle, uploading it to the google play console, and then installing on my phone. Will this still work?

1. Run gradlew assemble from src/UnityShowAndroidStatusBar/

Where is src/UnityShowAndroidStatusBar/? How to I run gradlew and what is it?

Over17 commented 2 years ago

Hi, and thanks for the interest!

The plugin is the two files you mentioned. Adding it to your project is as easy as

Where do I add this? Do I need to create a script and attach it to a game object ? I'm thinking I make a startManager game object and add a c#script to control stuff like this. Does that sound sensible ?

Correct.

"how to build" section could be skipped altogether, it's for those who want to modify the code of the plugin itself and rebuild it.

In an easiest case, all you need to do is copy Assets/ folder of this plugin into your project, and add a line to your scripts which sets fullScreen to false. Done.

More complicated cases require that you understand a bit of Unity, a bit of Android (at least manifest basics), a bit of programming.

Oh, one more thing. I developed the plugin quite some time ago, before Unity as a Library feature was introduced. These days, manifest may need to be applied in a more complicated way than just copying the file, see https://docs.unity3d.com/Manual/overriding-android-manifest.html. I will update the documentation here eventually, but cannot provide an ETA or any kind of support - sorry for that.