是否可以重置void循环?开始统一使用按钮吗?
void Start()
{
if (NoAnsweredQuestion == null || NoAnsweredQuestion.Count == 0)
{
NoAnsweredQuestion = question.ToList<Question>();
}
StartCoroutine("CountDownTimer");
SetcurrentQuestion();
}
答案 0 :(得分:1)
如果您的目标是多次在Start Method中执行代码,则您的设计很糟糕,但是如果您确实需要在Start Method中使用它,只需用不同的脚本销毁脚本,然后再次放上
我建议您仅在按下按钮时执行的方法中移动此代码。
无论如何,如“ Lestat”一样,您的问题确实很奇怪,我也不太理解。
答案 1 :(得分:0)
您可以使用以下方法创建函数:
public void YourFunctionName (){
if (NoAnsweredQuestion == null || NoAnsweredQuestion.Count == 0)
NoAnsweredQuestion = question.ToList<Question>();
StartCoroutine("CountDownTimer");
SetcurrentQuestion();
}
如果您正在使用Canvas(我建议您这样做!),只需添加一个新按钮:
然后使用“ +”号将功能添加到按钮上,拖动您的GameObject(附加了脚本),选择类,然后选择功能(必须公开才能起作用)。
我想这会解决您的问题。