当前位置:网站首页>Unity scene jump script
Unity scene jump script
2022-07-26 05:10:00 【You only exist in the game】
1. Jump scenes need to be added buildsetting
2. Scenario jump script Asynchronous loading is used here
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class SceneManager : MonoSingleton<SceneManager>
{
public UnityAction<float> onProgress = null;
public UnityAction onSceneLoadDone = null;
// Use this for initialization
protected override void OnStart()
{
}
// Update is called once per frame
void Update () {
}
public void LoadScene(string name)
{
StartCoroutine(LoadLevel(name));
}
IEnumerator LoadLevel(string name)
{
Debug.LogFormat("LoadLevel: {0}", name);
AsyncOperation async = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(name);
async.allowSceneActivation = true;
async.completed += LevelLoadCompleted;
while (!async.isDone)
{
if (onProgress != null)
onProgress(async.progress);
yield return null;
}
}
private void LevelLoadCompleted(AsyncOperation obj)
{
if (onProgress != null)
onProgress(1f);
Debug.Log("LevelLoadCompleted:" + obj.progress);
if (onSceneLoadDone != null)
onSceneLoadDone();
}
}
3. call
void OnLogin(Result result, string msg)
{
Debug.Log("dasaaaaaaaa");
SceneManager.Instance.LoadScene("CharacterSelect");
}
边栏推荐
- 嵌入式分享合集20
- Computable general equilibrium (CGE) model practice technology in resource environment under the goal of "double carbon"
- How many holes have you stepped on in BigDecimal?
- 基于遥感解译与GIS技术环境影响评价图件制作
- 35. 搜索插入位置
- 你对“happen-before原则”的理解可能是错的?
- 测试用例评审如何开展
- 测试必备工具之Fiddler,你真的了解吗?
- Map making of environmental impact assessment based on remote sensing interpretation and GIS technology
- unity场景跳转脚本
猜你喜欢
![[acwing] 2983. Toys](/img/e4/f71949a00ae604703d2b39bffb7c80.png)
[acwing] 2983. Toys

ALV报表流程图解

Improve reduce parallelism in shuffle operation

Compilation method of flood control evaluation report and flood modeling under the new guidelines

Switch and router technology: dynamic routing protocol, rip routing protocol and OSPF routing protocol

安装NCCL\mpirun\horovod\nvidia-tensorflow(3090Ti)
![[weekly translation go] how to write your first program with go](/img/77/cf77a46340a39797382fd7b60517d5.png)
[weekly translation go] how to write your first program with go

遥感、GIS和GPS技术在水文、气象、灾害、生态、环境及卫生等领域中的应用

Excel VBA: summarize calculation output results by date (SUMIF)

Seata两阶段提交AT详解
随机推荐
Molecular skeleton transition tool -delinker introduction
ThreadLocal transfer between parent and child threads in asynchronous
Mysql优化
地球系统模式(CESM)实践技术
【洛谷】P3919 【模板】可持久化线段树1(可持久化数组)
[weekly translation go] how to write your first program with go
CountLaunch Demo的测试
MODFLOW Flex、GMS、FEFLOW、HYDRUS实践应用
Add and modify the verification logic, and use -validation- to complete the group verification
Why is the value represented by a negative number greater than an integer by 1?
Icml2022 | imitation learning by evaluating the professional knowledge of the presenter
[Luogu] p3919 [template] persistent segment tree 1 (persistent array)
List converted to tree real use of the project
Nacos introduction and deployment
Date and time function of MySQL function summary
Excel VBA:将多个工作表保存为新文件
Common solutions for distributed ID - take one
ALV报表流程图解
SAP报表开发步骤
Compilation method of flood control evaluation report and flood modeling under the new guidelines