I’ve managed to consistently crash unity. I’ve almost narrowed it down, but hopefully I’m just doing something stupid that someone can correct me on.
What I’m doing is OnPlayerConnected (in each object) sends a bunch of state information as RPCs to the player. It’s for stacks of chips (like in poker). I’m sending the state information instead of using buffered because after a while I expect chips to move in and out of stacks constantly, so instead once the player joins I’ll just initialize them with current stack state. Current stack state is a bunch of “AddChipToStack” calls. There is also the fact that stacks can disappear and be reformed as new stacks (if you empty the current stack it is destroyed)
The problem is that this crashes Unity. It always crashes, but not always at the same point.
I think one problem may have been related to Network.Destroy. But I have problems even if I remove Network.Destroy. In fact, even at the very beginning when I’ve just created the initial stacks without destroying any the client crashes. It looks like it sends the RPCs properly but then the client will crash. (I’m only testing with the Editor and Web… but it crashes in both places.) In the network debug, I can see before it crashes the client is sending it’s own network instantiate to create it’s camera/avatar and then immediately dies after.
If I reduce the number of chips down to a very small number 8 vs 80 total, then I have no problems. If I remove the “AddChipToStack” in the OnPlayerConnected, I also have no problem (although the client is then out of sync)… in fact once the player is connected I don’t think I have crashes (although I haven’t tested that thoroughly).
I want to think it has something to do with having too many RPCs coming in, or maybe a weird combination of Network.Instantiates and RPCs that is creating problems…
Any suggestions would be greatly appreciated.
Thanks!