【发布时间】:2019-09-09 07:55:39
【问题描述】:
我在这件事上大发雷霆。
如何使这段代码使分配的音频文件完全运行?我知道更新方法只运行每一帧,但我如何让它运行直到音频完成?音频开始然后立即中断,因为它是每一帧。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class checkifdone : MonoBehaviour
{
public AudioSource checkwin;
private bulbmanager bulbreq;
// Start is called before the first frame update
void Start()
{
bulbreq = FindObjectOfType<bulbmanager>();
}
// Update is called once per frame
void Update()
{
checkaudio();
}
void checkaudio()
{
if (bulbreq.bulbcount >= 8)
{
checkwin.Play();
}
}
}
我尝试将它放在 void start() 中,但这根本没有帮助,因为 start 是关卡的开始。
【问题讨论】: