- Home /
Is there a way for a generic function to work as "yield return StartCoroutine()"?
I'm trying to get it to work, but it's not working my way.
I want to terminate the thread when I mouse input, and then do the next function.
Please help me..
private bool isCanNext;
Task waitTask;
public void StartFinishInteraction()
{
gameObject.SetActive(true);
//source = transform.parent.gameObject.AddComponent<AudioSource>();
//source.PlayOneShot(Resources.Load("Sound/GameClear") as AudioClip);
SoundManager.Instance.PlayOneShot("Sound/GameClear");
PlayAnimOnce();
waitTask = null;
waitTask = Task.Run(() =>
{
isCanNext = false;
isCanTouch = true;
while(!isCanNext)
{
if (isTouching)
{
isCanNext = true;
break;
}
}
});
Task.WaitAll(waitTask);
}
Comment