I made an Android plugin for Unity3d that changes the background on the launch screen, now the background is registered using code:
<style name="SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
**<item name="android:windowBackground">@drawable/background_splashscreen</item>**
</style>
How can you change it using code in Unity?(Apparently you need to use native code)
To set the background of an Activity via Unity3D, you can make use of the "UnityPlayerActivity" class provided by Unity. Here are the steps to achieve this:
In your Unity project, navigate to the "Assets/Plugins/Android" folder. If the folder doesn't exist, create it.
Create a new Java class file within the "Android" folder and name it something like "CustomUnityPlayerActivity".
Open the "CustomUnityPlayerActivity" file and extend it from "com.unity3d.player.UnityPlayerActivity":
Save the Java file.
Export your Unity project for Android as an APK.
Open your Android project in Android Studio.
In the "build.gradle" file of your Android project, add the following line to the "dependencies" section:
Make sure to replace "unityLibrary" with the name of your Unity library module.
<activity>tag that represents the UnityPlayerActivity and change its name to reference your custom activity, like this:With these steps, you should now have a custom UnityPlayerActivity that sets the background color of the Activity to red. You can modify the
setBackgroundColormethod with any color or background resource that you desire.