• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SweatyChair · Apr 05, 2019 at 01:38 AM · androidsplash screenplayer settings

Set Android's Static Splash Image using API?

I couldn't found any API function to set the static splash image in Android, is that not supported? I can find Unity's splash screen but not the static image.


I may expecting something like this:

 PlayerSettings.Android.staticSplashImage = mySprite;


And it sets the Android splash image like this (NOT Unity's Splash Screen!): alt text


P.S. I am building a bunch of Android games and writing a tools to set all player settings include my splash screen without the need to change 1by1.

screen-shot-2019-04-08-at-103637-am.png (49.1 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Chris333 · Apr 05, 2019 at 07:42 AM

It seems that you can set the general splash images that way which should also change the splashscreen on android.


 using UnityEngine;
 using UnityEditor;
 
 public class ExampleScript
 {
     [MenuItem("SplashScreen/AssignLogos")]
     public static void AssignLogos()
     {
         var logos = new PlayerSettings.SplashScreenLogo[2];
 
         // Company logo
         Sprite companyLogo = (Sprite)AssetDatabase.LoadAssetAtPath("Assets/SplashScreen/companylogo.jpg", typeof(Sprite));
         logos[0] = PlayerSettings.SplashScreenLogo.Create(2.5f, companyLogo);
 
         // Set the Unity logo to be drawn after the company logo.
         logos[1] = PlayerSettings.SplashScreenLogo.CreateWithUnityLogo();
 
         PlayerSettings.SplashScreen.logos = logos;
     }
 }



Source: PlayerSettings.SplashScreen.logos


Also node that it seems you cant do that with a personal subscription. Source:
Customizing an Android Splash Screen


Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SweatyChair · Apr 08, 2019 at 12:39 AM 0
Share

Hi Chris, Thanks for the answer. However that's not the one I looked for. I did want the static splash image but not Unity's splash screen...

avatar image
0

Answer by cumi233 · Apr 21, 2020 at 11:54 AM

I have the same problem, I can't find the API to set Android's static splash image. but I find another way, maybe not very good but helpful, hope there is a better way.

 string projectSettingsPath = Application.dataPath.Replace("/Assets", "/ProjectSettings/ProjectSettings.asset");
 StreamReader r = new StreamReader(projectSettingsPath);
 StringBuilder builder = new StringBuilder();
 while (!r.EndOfStream)
 {
     string str = r.ReadLine();
     if (str != null && str.Contains("androidSplashScreen"))
     {
         string newStr = "  androidSplashScreen: {fileID: 2800000, guid: " 
                         + AssetDatabase.AssetPathToGUID("Assets/logo.png") 
                         + ", type: 3}";
         builder.AppendLine(newStr);
         continue;
     }
 
     builder.AppendLine(str);
 }
 r.Close();
 File.WriteAllText(projectSettingsPath,builder.ToString());


alt text

Update! I find another way in this forum, and finally I change Android's static splash image in this way. link text

 Texture2D tex = AssetDatabase.LoadAssetAtPath("Assets/Logo/logo_default.png");
 const string projectSettings = "ProjectSettings/ProjectSettings.asset";
 UnityEngine.Object obj = AssetDatabase.LoadAllAssetsAtPath(projectSettings)[0];
 SerializedObject psObj = new SerializedObject(obj);
 SerializedProperty androidSplashFileId = psObj.FindProperty("androidSplashScreen.m_FileID");
 if (androidSplashFileId != null)
 {
     androidSplashFileId.intValue = tex.GetInstanceID();
 }
 psObj.ApplyModifiedProperties();


Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

226 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android splash screen not working 4 Answers

Android Unity game crashed on some devices after splash screen 0 Answers

Unity Complete Editor Become Pink - Unity Editor Bug 1 Answer

Advice for various splash screens on Android 2 Answers

Wrong data in the Android manifest after build gradle with export in Unity 2018.1 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges