Need help to understand and fix my crash log.

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?

crash log files:

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:

http://plbm.com/?p=220

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?

Not in my experience. For me Unity hardly ever crashes. It does, but usually only in the editor.

Unity itself is like a beast game engine… the thing just chugs on and on.

Far more often crashes are my code or a third party piece of code that crashed.

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:

esh.SetIndexBufferParams(vertexCount, IndexFormat.UInt16);

mesh.SetVertexBufferData(job.OutputVertices, 0, 0, vertexCount, 0, MeshUpdateFlags.DontValidateIndices);
mesh.SetIndexBufferData(job.OutputTriangles, 0, 0, vertexCount, MeshUpdateFlags.DontValidateIndices);

Obvious first try is to rerun without MeshUpdateFlags.DontValidateIndices

Then maybe you can get info on the bad data going in.

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:

UnloadTime: 2.168400 ms
Setting up 4 worker threads for Enlighten.
  Thread -> id: 65d8 -> priority: 1
  Thread -> id: 51e8 -> priority: 1
  Thread -> id: 4388 -> priority: 1
  Thread -> id: 5ef4 -> priority: 1
##utp:{"type":"MemoryLeaks","version":2,"phase":"Immediate","time":1611115448475,"processId":24652,"allocatedMemory":200775,"memoryLabels":[{"Permanent":24},{"NewDelete":108},{"Thread":64},{"Manager":1612},{"GfxDevice":196720},{"Serialization":24},{"WebCam":12},{"String":191},{"HashMap":768},{"PoolAlloc":32},{"GI":184},{"VR":780},{"NativeArray":256}]}

There’s way to much native array allocated and disposed constantly to know which one wasn’t properly disposed, in case it is, in fact, a memory leak…

[Edit] I forgot to mention that I somehow wasn’t able to get any error throws that could explain the previous crash, this is odd.

I’ve now added a few prompts to display memory usage.
Pretty much every values is rising…

Interesting to know about if people are getting issues with memory leaks in unity even is c# is a managed language. Is it necessary to destroy the instance material manaully in Unity 3.5? ?_ga=2.43973861.153613755.1611066224-691859724.1522971432