Search Unity

Adding Loading Screen While Unity is getting Loaded

Discussion in 'iOS and tvOS' started by AbhishekS, Jan 29, 2009.

  1. AbhishekS

    AbhishekS

    Joined:
    Dec 15, 2008
    Posts:
    157
    Hieeee Guys currently im trying to add a Loading screen showing progress indicator while Unity is getting loaded


    Code (csharp):
    1. - (void) applicationDidFinishLaunching:(UIApplication*)application
    2. {
    3.     .....
    4.     [b]UnityInitApplication(appPath);[/b]
    5.     .....
    6. }
    can i show a progress Indicator showing the states of the UnityInit???? or can i just show an img. stating tht we are loading something.
    does Unity has any option for showing this????
     
  2. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    What is your build target?

    - Web player builds show our the web player loading screen (graphic and progress bar) that can be customized (Pro-only) with your own graphics.

    - Stand-alone builds only have the resolution dialog but that's not quite a loading screen. After that you just have to wait for the engine to load before you can show anything.

    - Finally, iPhone builds have a loading screen that you can customize if you're using Unity iPhone Advanced.
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    but you can not show a bar on the initial screen. Thats a hardlock phase and all you can do is show a static image. Thats not a Unity restriction but how iphone works.
     
  4. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Correct.
     
  5. AbhishekS

    AbhishekS

    Joined:
    Dec 15, 2008
    Posts:
    157
    okkk How can i configure Unity to Show Image on screen (Apart from Default.png) when Unity3D is getting Loaded wont ming even if we are not able to show Progress Indicator.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Default.png is what is shown by default on the iphone. you can not use another name.
    but you can replace Default.png, given you have Unity iPhone Advanced
    With the basic, you must use the one that is provided by Unity, thats a part of the license.
     
  7. AbhishekS

    AbhishekS

    Joined:
    Dec 15, 2008
    Posts:
    157
    i have already purchased the Original Copy Of unity im able to change the Default.png thts not a problem

    what i realy want is to add one more .png file after default.png is shown while The Unity is getting loaded tht is when UnityInitApplication(appPath); function is called as loading this itself take 2-3 sec. of time.

    i want o show another img. while unity is getting loaded in the Background
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I think that could be achieved by adding a dummy scene which has nothing else than the cam and a guitexture in.
     
  9. AbhishekS

    AbhishekS

    Joined:
    Dec 15, 2008
    Posts:
    157
    this is not possible as unity has not been completed loaded its getting loaded. so adding a GUITexture wont help i though there might have been an internal setting to show that the Unity is getting loaded
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    no thats why the iphone app loading image is shown, so you know that it at least has not went to hell

    you should be able to just replace that with a different image as it is possible to set it.
     
  11. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    The vast majority of that start-up time is spent by the OS, and you can't change that. You can display a loading screen for after applicationDidFinishLaunching: but you'd be surprised at how quickly it'll be gone.

    Basically, you have to:

    - create a new UIWindow and make it key and visible
    - create and add subviews to display in the window (i.e. text, progress bar)
    - create a POSIX thread to advance the subviews (i.e. advance a progress bar, change text, etc.) and start it. You can't use Cocoa threads (NSThread, performSelectorInBackground, etc.) because the Unity engine initialization blocks the runloop and you end up with just one iteration of your thread.
    - then, init Unity
    - clean it all up when the Unity engine is done initializing

    You also have to send setNeedsDisplay to the views to force them to draw. It feels kludgy but it works.
     
  12. PAHeartBeat

    PAHeartBeat

    Joined:
    Jul 11, 2012
    Posts:
    76

    May we can not modified initial loading screen of application, but even We tried to lot show bar in the scene when another scene is loading using AsyncOperation and Application.LoadLevelAsync but it's not help much ...