I first tried my multiplayer game with some friends today and it crashed even though it never did in the editor. The game crashed when doing no particular action. Somehow hosts haven’t crashed yet, only clients. I don’t see any notable reason the game would crash in the logs. No matter how hard I try, I can’t figure out WHEN the crash occurs.
What’s the first thing I should attempt to find the source of the issue?
Always google any information your crash log gives you.
Beyond that, to help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
is this code even running? which parts are running? how often does it run?
what are the values of the variables involved? Are they initialized?
Knowing this information will help you reason about the behavior you are seeing.
When you start to narrow down the problem, here is how to report your problem productively in the Unity3D forums:
I’ll try to littler the code with debug.log, but I have another question:
If I understand correctly, crashes are mostly unity errors and you shouldn’t be really getting one in case of a coding mistake (other than an infinite loop) right?
Ok, so, I ran a debug build, played around with it for 30 minutes, and it finally crashed again.
From what I’ve read from the crash log (that looks very similar to the previous crash), it seems to be all pointing to the terrain system’s mesh generator, which I haven’t completely made myself, I mostly edited an incomplete marching cube system from someone else.
mesh.SetVertexBufferParams(vertexCount, MeshingVertexData.VertexBufferMemoryLayout);
is the line being referred to in the code. It is immediately followed by:
I had the same idea before I saw your response, I tried it, played around for 30 min and it finally crashed again. Now this time there wasn’t any crash notice in the client log, except for this single message: