using System; using System.Collections; using Unity.Netcode; using UnityEngine; public class ClientReadyHelper : MonoBehaviour { private static bool isClientReady = false; public static void SetClientReady() { isClientReady = true; Debug.Log("[Client] Client is now ready to receive RPCs."); } public static bool IsClientReady() { return isClientReady; } public static void ProcessRPC(Action action, MonoBehaviour caller) { if (!isClientReady) { caller.StartCoroutine(WaitForClientReady(action)); return; } action.Invoke(); } private static IEnumerator WaitForClientReady(Action action) { yield return new WaitUntil(() => isClientReady); action.Invoke(); } }