DEV Community

Alexzander Khan Paul
Alexzander Khan Paul

Posted on

Unity 开场动画更改(个人版)

来自Deepseek的解决方案

步骤:

制作一个开场场景

新建一个场景(如 IntroScene),放置你的自定义动画(用 Animation、Timeline 或 UI 淡入淡出)。

示例:使用 UI Image + Animator 控制图片动态显示。

脚本控制跳转

在 IntroScene 中添加脚本,延时后跳转到主场景:

using UnityEngine;
using UnityEngine.SceneManagement;

public class CustomSplash : MonoBehaviour
{
    public float delay = 3f; // 动画持续时间
    void Start()
    {
        Invoke("LoadMainScene", delay);
    }
    void LoadMainScene()
    {
        SceneManager.LoadScene("MainScene");
    }
}
Enter fullscreen mode Exit fullscreen mode

设置为首个场景

在 Build Settings 中将 IntroScene 拖到场景列表的顶部,确保优先加载。

Top comments (1)

Collapse
 
alexzander_khan_paul profile image
Alexzander Khan Paul

Aaaaa! I'm a Unity beginner and want to record what I've learned, so I'm taking notes here. >_<