I don’t understand why this script (run on the server) is giving me an error:
function Update () {
if (Network.connections.length > 0) {
myVar = (something else);
networkView.RPC ("MyFunction", RPCMode.OthersBuffered, myVar);
}
}
@RPC
function MyFunction (myVar : float) {
}
What I want to happen is for “MyFunction” to be called and the variable “myVar” to be passed over the network while any client is connected. That works, but when the client disconnects I get this error:
Which is what I don’t understand. If the client logs off the network the function should stop running, so why the error? I can’t find anything in the docs that would explain this, how do I fix this??
It is possible that the client disconnects while the RPC is in progress. Especially if you are doing an update every frame.
I’ve had small issues like this before and really, I don’t think there is much you can do about it. Having an error output surely isn’t that bad for this case?
This isn’t causing the application to crash is it?
dreamora, yes, I am managing everything through RPCs. Maybe not the best way to do it, but it was the way I knew how to do it. There isn’t much to manage so I guess it isn’t all that bad.
Hogus, I am going to try and see if my program crashes. Hopefully it won’t.
I would guess that the RPC is sent at just before the player disconnects, and that is the reason for the failure. That would make the most sense to me (but I really hope the game doesn’t crash).
server sends an RPC to other players when some player has disconnected, so if 2 players disconnect at the same time i get RPC error even if i clean up the RPCs and check the existing connections
this is god damn annoying, what am i supposed to do ? pokemon exception handle all RPCs ?
Update:
ohgod, i can’t even try catch everything.
seems like it stacks the RPCs in a que and then executes them a couple of frames later or something.
i give up, there is no cure for this.
anybody knows some other networking library that doesn’t have this issue, but still is similar to unity (except ulink) ? >:C
im having same problem. its now been some time since 1st reported any resolution, fix, workaround, change in my code i could do. or can i simply ignore it and other players its trying to do will occur for that rpc call so i dont have to worry. what im worrying about is that players after the failing one will not be updates.
so for example 5 players, 1 gets rpc no problem, 2 rpc call fails, and 3, 4, 5 do not get call at all cause exception is thrown and the code is exited…
so anyone know what will happen. nice if unity dev with access to source code will say what exactly will happen and what if anything we should do…
i mean we cant write code that catches the error check one player failed and then reissue the call for remaining. we r not given that level of control. and we dont know which one it fails at the api dont say…
it would be nice if rpc call would continue after ones that fail and send to all players… so in my example when 2 fails it just goes on to 3,4,5 and even if if it then did 3 and 4 failed it just went to 5…ect
one thing i could do my oen all/other by just looping around myself and issue the call to each player n if any fail catching and continuing the loop…
Yep, can we get that kind of info ? Would the RPC que continue to execute once one has failed due to player disconnect ?
I find it kinda hard to check that myself, but I guess it does due to UDP nature of raknet.