- Home /
ClientRpc is not being called on OnStartClient
Hello there, I accidentally delete one of my prototype file and I wanted to rewrite it and I was surprised cause ClientRpc was not being called on host (I rather have problems with it to be called on remotes).
I'm using my Custom LobbyManager and I spawn my GameManager in it and when GameManager is spawned I call Rpc on startup but it just doesn't work so I started digging how I made it work previous time and I remembered that I used Coroutine and voilà.
My RPC doesn't work if it's directly in OnStartClient but it works perfectly when I use it in Coroutine with minimal yield before calling it...
public override void OnStartClient()
{
Test();
}
[Server]
private void Test()
{
controller.RpcCallTest(0.005f, 0.05f);
}
it doesn't work but this one does
public override void OnStartClient()
{
Test();
}
[Server]
private void Test()
{
StartCoroutine(Weird());
}
private IEnumerator Weird()
{
yield return new WaitForSeconds(0.1f);
controller.RpcCallTest(0.005f, 0.05f);
}
TL;DR ClientRPC doesn't work on localclient when I call it OnStartClient but when I wrap it in coroutine it works perfectly. Or maybe it is how supposed to be?
sounds like a design flaw to me since there's really no other useful callback.
Have you checked this out?
What do you mean if I checked this out? :) It still doesn't work how it supposed to be working. Or maybe it's supposed to work that way, anyway if I knew it earlier not after hours of trying to get it fixed :D
Your answer
Follow this Question
Related Questions
How to solve Couldn't send rpc function[server to player] 1 Answer
UNET Rpc calls wrong inherited script 2 Answers
RPC sync issues 0 Answers
RPC call behaviour on own client 1 Answer
Is an RPC call asynchronous? 2 Answers