Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Custom Splash Screen for Standalone

Discussion in 'Editor & General Support' started by Bailywick, Nov 10, 2015.

  1. Bailywick

    Bailywick

    Joined:
    Mar 11, 2015
    Posts:
    17
    I'm using unity pro and currently for iOS have a splash screen image shown before the main app throws up a loading screen (the app is generally launched from a webpage link and it's great to show straight away that the expected app is doing something). It's set up using the legacy Launch images. I'm now working on a Standalone build for windows and there is an option for displaying the unity splash screen (which shows up exactly when I would like mine to appear) but no option to add a custom image instead. It looks to me like the windows app build settings have a launch image property, and so does Android but Standalone does not.

    I've tried playing around with OnGUI and various other hooks in my load scripts to see if I can render anything myself but I don't seem able to get anything on screen until about 5 seconds have passed (when my loading screen arrives anyway). I did little searching around and found this old topic:
    http://forum.unity3d.com/threads/splash-screen-for-my-standalone-game.119643/
    It's pretty old and the recommended link no loner works unfortunately. It seems there was some way in the past (that maybe still works). Does anyone know of a way to have a custom splash screen for a Standalone project?
     
  2. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I don't use Splash images on any platform as we like ours to be animated. We achieve this by having very small blank image as the splash image and a Splash Screen Scene that is loaded first containing just the splash image and animation, that scene then triggers an async load of the main menu scene while the splash screen animates.

    Another reason why this is a good solution is that you don't need to supply different splash images for each resolution, the 3D camera takes care or rendering a billboard in 3D space and as long as it's framed correctly should work in any aspect ratio and resolution.
     
  3. Bailywick

    Bailywick

    Joined:
    Mar 11, 2015
    Posts:
    17
    Thanks for the reply, this sounds very like how our project handles loading - we have a background image with loading spinner animation. After this is shown we kick off the loading in async. The problem I'm having is that it typically it takes a few seconds (3 - 5) before the loading screen is displayed when the window is just pure white. On iOS the splash screen is used to cover this initial period with an image. I'd like to do this for Standalone builds too but can't work out how.
     
  4. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I haven't experienced the initial scene taking that long to load up. Does your initial scene only the bare minimum to show a splash screen? If not then you might be loading more then you need before Unity has a chance to render anything, taking longer to display the splash scene.
     
  5. Bailywick

    Bailywick

    Joined:
    Mar 11, 2015
    Posts:
    17
    Sorry for the slow reply. On our initial scene does have a fair amount going on.

    The main scene contains:
    GameObject - configuration
    * Links to our loading script (this is what sets off our async loading and is where I've been adding our test splash screen rendering. Test code was added to OnGUI with all the loading commented out for test purposes).
    GameObject - Metaio SDK
    GameObject - Metaio Tracker
    Game Object Metaio Tracker surface
    * Block of Metaio scripts (tracking models and such are loaded later by configuration)

    I guess it must be the Metaio SDK that is slowing things down. But I don't know how we could jump in before they're loaded. I guess I'm also wondering why other platforms seem to have a simple build in way to do a splash screen but standalone doesn't. As I said earlier the Unity Splash image appears straight away so I wonder why I can't get something to do the same.
     
  6. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    You can do a empty scene with a splash screen of yours and a script that does asynchronously loads the main scene.
    That way your splash screen shows up very fast and will be shown until the main scene is loaded.
     
  7. Bailywick

    Bailywick

    Joined:
    Mar 11, 2015
    Posts:
    17
    Thanks for laying it out so clearly! I guess I'd overlooked the obvious (this is my first look at the unity scene setup as another team member originally set this up). I now have a working splash screen!

    It appears almost as quickly as the unity splash, less than a second for sure (although I do still think it would be nice to give standalone builds a way to add a splash screen using the same hooks, as is possible on other platforms). My splash image remains in place until the original scene gets in order enough to display something else.

    Step by step guide:

    Create LoadMain script:
    Code (CSharp):
    1. public class LoadMain : MonoBehaviour
    2. {
    3.     void Start()
    4.     {
    5.         Application.LoadLevel(1);
    6.     }
    7. }

    • Created a new scene
    • In Hierarchy window:
      • Remove all default objects (camera and directional light)
      • Right click->Create Empty
        • Add Component -> LoadMain (script created above)
      • Add Raw Image -> Set to splash image
    • In Build Settings ensure that this new scene is 0 and original scene is 1 in top half of window.
     
    fffMalzbier likes this.