Unity
private void Start()
{
_a = A();
StartCoroutine(_a);
}
private IEnumerator A()
{
Debug.Log("sA");
yield return StartCoroutine(B());
Debug.Log("eA");
}
private IEnumerator B()
{
Debug.Log("sB");
yield return new WaitForSeconds(1);
Debug.Log("eB");
}
private void Update()
{
if (pause)
{
StopCoroutine(_a);
}
}
sA
sB
eB
eB
sA
sB
StopCoroutine(_a);
eB
親コルーチンが止まっても子コルーチンは止まらない
(StartCoroutineを実行すると別物とされるため)
これならうまくいく
private void Start()
{
_a = A();
StartCoroutine(_a);
}
private IEnumerator A()
{
Debug.Log("sA");
yield return B();
Debug.Log("eA");
}
private IEnumerator B()
{
Debug.Log("sB");
yield return new WaitForSeconds(1);
Debug.Log("eB");
}
private void Update()
{
if (_pause)
{
StopCoroutine(_a);
}
}
private IEnumerator A()
{
Debug.Log("startA");
yield return new WaitForSeconds(100);
Debug.Log("endA");
}
100秒待機中に停止・再開始すると、100秒は無視され即座に"endA"が出力される。
private IEnumerator A()
{
Debug.Log("startA");
yield return B();
Debug.Log("endA");
}
private IEnumerator B()
{
Debug.Log("startB");
yield return new WaitForSeconds(1);
Debug.Log("endB");
}
上も同様
private IEnumerator A(INLCoroutineExecutor executor)
{
Debug.Log("startA");
yield return executor.Run(B);
Debug.Log("endA");
}
private IEnumerator B(INLCoroutineExecutor executor)
{
Debug.Log("startB");
yield return executor.Kill();
Debug.Log("endB");
}
内部から外部のStopCoroutineを実行すると止まると思いきや止まらない
外部からStopCoroutineを実行すると止まる。
link.xmlを書く
Jan 7, 2024Physics-Overlap00関数を大量に使用する機会があったが、事前に座標を取得して(動いたオブジェクトのみ更新)自分で計算したほうがある程度の数までは早いことが分かったので、できるだけある程度の個数を増やそうとする試みです。
Dec 20, 2023.net7 window10
Dec 20, 2023https://github.com/dotnet/roslyn-sdk/blob/main/samples/CSharp/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.cs
Dec 10, 2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up