Unity 脚本 | Unity3d 跳过启动动画

王先生
2024-06-06 / 0 评论 / 28 阅读 / 正在检测是否收录...

用 Unity3d 写的小程序编译好后,总是有启动动画,有时候就很烦。
研究了一下,把以下脚本放到项目中,不用挂载,再编译就没有启动动画了。

新建一个脚本,起名为 SkipUnity3DStartMove.cs
打开把以下内容粘贴进去

using UnityEngine;

public class SkipUnity3DStartMove : MonoBehaviour
{

    #region 跳过启动动画
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
    private static void BeforeSplashScreen()
    {
        System.Threading.Tasks.Task.Run(Asyncskip);
    }
    private static void Asyncskip()
    {
        UnityEngine.Rendering.SplashScreen.Stop(UnityEngine.Rendering.SplashScreen.StopBehavior.StopImmediate);
    }
    #endregion
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

评论 (0)

取消