以下の内容はhttps://baba-s.hatenablog.com/entry/2022/09/27/090000より取得しました。


【Unity】LateFixedUpdate の実装例

ソースコード

using System.Collections;
using UnityEngine;

[DisallowMultipleComponent]
public sealed class Example : MonoBehaviour
{
    private void OnEnable()
    {
        StartCoroutine( nameof( UpdateLateFixedUpdate ) );
    }

    private void OnDisable()
    {
        StopCoroutine( nameof( UpdateLateFixedUpdate ) );
    }

    private IEnumerator UpdateLateFixedUpdate()
    {
        var waitForFixedUpdate = new WaitForFixedUpdate();

        while ( true )
        {
            yield return waitForFixedUpdate;
            LateFixedUpdate();
        }
    }

    private void FixedUpdate()
    {
        Debug.Log( nameof( FixedUpdate ) );
    }

    private void LateFixedUpdate()
    {
        Debug.Log( nameof( LateFixedUpdate ) );
    }
}

使用例

FixedUpdate の後に LateFixedUpdate が呼び出される




以上の内容はhttps://baba-s.hatenablog.com/entry/2022/09/27/090000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14