惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Project Zero
Project Zero
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
G
Google Developers Blog
V
V2EX
S
Schneier on Security
博客园 - 司徒正美
博客园_首页
Know Your Adversary
Know Your Adversary
The Last Watchdog
The Last Watchdog
美团技术团队
量子位
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
C
CERT Recently Published Vulnerability Notes
J
Java Code Geeks
T
Tenable Blog
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
C
Check Point Blog
Forbes - Security
Forbes - Security
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
O
OpenAI News
PCI Perspectives
PCI Perspectives
The Cloudflare Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
D
Docker
TaoSecurity Blog
TaoSecurity Blog
Security Latest
Security Latest
S
Secure Thoughts
AWS News Blog
AWS News Blog
AI
AI
N
News | PayPal Newsroom
Scott Helme
Scott Helme
S
Security @ Cisco Blogs
A
Arctic Wolf
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
SegmentFault 最新的问题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Privacy International News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
News and Events Feed by Topic
Vercel News
Vercel News
C
Cybersecurity and Infrastructure Security Agency CISA

博客园 - 阿土仔

Unity 2019中对象池的用法 Unity UGUI动态生成控件 Unity场景间数据传递方法 UGUI防止穿透和判断点击的是否是UI Unity中的Character Controller Unity插件研究-EasyTouch V5 Unity塔防游戏的创建 Unity性能优化-DrawCall Unity性能优化-对象池 Unity性能优化-音频设置 Unity性能优化-遮挡剔除 Unity 协程 HBuilder git使用-分工合作 HBuilder git合作-代码同步 微信小程序开发-窗体设置 HBuilder git合作-从Git Hub Clone项目 HBuilder git合作-上传项目到Git Hub 微信小程序开发-tabbar组件 HBuilder git使用-建立仓库,邀请用户
Unity异步加载场景
阿土仔 · 2019-07-09 · via 博客园 - 阿土仔

在游戏中,经常可以看到从一个关卡跳到另一个关卡时,有一个显眼的进度条,研究了下,其时也很简单:

public void LoadAScene()
{
    StartCoroutine(LoadSceneAsync("SampleScene"));
}

IEnumerator LoadSceneAsync(string sceneName)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName);
operation.allowSceneActivation = false;
while (!operation.isDone)
{
#if UNITY_EDITOR
Debug.Log("Progress is :" + operation.progress);
#endif
float progress = Mathf.Clamp01(operation.progress / 0.9f);
ProgressSlider.value = progress;
ProgressText.text = ((int)progress * 100).ToString() + "%";
yield return null;
}
operation.allowSceneActivation = true;

}