简体   繁体   English

以编程方式延长启动屏幕上Android加载指示器的持续时间

[英]Programmatically prolonging the duration of Android loading indicator on the splash screen

Is there anyway via code to prolong the duration of the Android loading indicator on the splash screen? 无论如何,有没有通过代码来延长启动屏幕上Android加载指示器的持续时间?

In the Player Settings, I choose the large one and I also include: 在“播放器设置”中,我选择较大的一个,并且还包括:

#if UNITY_ANDROID
    Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
#endif

But no matter which one is done, the loader only appears for a fraction of a second which is not noticeable to the user. 但是,无论执行哪一个操作,加载程序只会出现一秒钟的时间,而这对于用户而言并不明显。

Our android app has a long loading time, so I would like a way of telling the user that something is happening... 我们的android应用的加载时间很长,所以我想一种告诉用户正在发生的事情...

I don't think there is anyway to place something on this splash screen (like a UI element with a message, etc...) for user feedback. 我认为无论如何都不会在此初始屏幕上放置任何内容(例如带有消息的UI元素等)以供用户反馈。 Is there?? 在那儿??

It is not possible to increase the time of android splash screen. 无法增加android启动画面的时间。 If your app have long loading time then you have to design your own loading screen using Progress indicator. 如果您的应用加载时间较长,则必须使用进度指示器设计自己的加载屏幕。

You can prolong the Splash screen with Unity's SplashScreen API. 可以使用Unity的SplashScreen API延长Splash屏幕。 Initialize splash screen with SplashScreen.Begin() then wait in a while loop while calling SplashScreen.Draw(); SplashScreen.Begin()初始化启动画面,然后在调用SplashScreen.Draw();while循环等待SplashScreen.Draw(); to draw the splash screen every frame. 每帧绘制初始屏幕。 You must also yield or wait in that while loop so that your whole game will not freeze. 您还必须在该while循环中屈服或等待,以免整个游戏冻结。

bool keepShowingSplashScreen = false;

IEnumerator Start()
{
    SplashScreen.Begin();

    while (keepShowingSplashScreen)
    {
        SplashScreen.Draw();
        yield return null;
    }
}

When you want to exit the splash screen, set keepShowingSplashScreen to false . 如果要退出启动画面,请将keepShowingSplashScreen设置为false The while loop will end and your game will continue. while循环将结束,您的游戏将继续。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM