how do you interpret error logs?

How can I interpret and fix the error logs? I have a bug somewhere it seems the game always crashes (not in the same spot) the same way, and error logs all say basically the same thing
here is an example of two error logs with minutes of difference

Unity Player [version: Unity 4.2.0f4_38efbd14869d]

favoreme.exe caused an Access Violation (0xc0000005)
  in module favoreme.exe at 0033:403f335c.

Error occurred at 2013-11-02_195218.
I:\Builds\favoreme.exe, run by rayco.
75% memory in use.
3264 MB physical memory [813 MB free].
10808 MB paging file [3372 MB free].
8388608 MB user address space [8388050 MB free].
Read from location ffffffff caused an access violation.

Context:
RDI:    0x0bbefce0  RSI: 0x00000004  RAX:   0x00000000
RBX:    0x0b4f7570  RCX: 0x00000000  RDX:   0x0000000f
RIP:    0x403f335c  RBP: 0x00000030  SegCs: 0x00000033
EFlags: 0x00010202  RSP: 0x001ef410  SegSs: 0x0000002b
R8:    0x00000003  R9: 0x0bbefbf8  R10:   0x00000286
R11:    0x001ef3d0  R12: 0x00000008  R13:   0x00000001
R14:    0x0ba51e28  R15: 0x03d9c428

and the second one

Unity Player [version: Unity 4.2.0f4_38efbd14869d]

favoreme.exe caused an Access Violation (0xc0000005)
  in module favoreme.exe at 0033:406a335c.

Error occurred at 2013-11-02_195758.
C:\Users\rayco\Documents\Build\favoreme.exe, run by rayco.
75% memory in use.
3264 MB physical memory [797 MB free].
10808 MB paging file [3315 MB free].
8388608 MB user address space [8387924 MB free].
Read from location ffffffff caused an access violation.

Context:
RDI:    0x27663b80  RSI: 0x00000002  RAX:   0x00000003
RBX:    0x14a87570  RCX: 0x00000009  RDX:   0x0000000c
RIP:    0x406a335c  RBP: 0x00000018  SegCs: 0x00000033
EFlags: 0x00010202  RSP: 0x001af2c0  SegSs: 0x0000002b
R8:    0x00000003  R9: 0x27663a40  R10:   0x00000286
R11:    0x001af280  R12: 0x00000008  R13:   0x00000001
R14:    0x2773fa78  R15: 0x03dac428

It happens sometimes when I hit an enemy, specially if there is more than one enemy on screen. How can I interpret this to find the bug?

In “theory”, you should not be able to produce an access violation with just writing C# code. (At least not easily). I doubt that the idea of “exception catching” in the comments would help you here, since the crash probably happens outside the C# environment control.

Without the Unity source code and symbol table, the crash log is not really helpfull either.

Here a general description about how to find any kind of bug systematically. It really works, I do this dozends of times a week:

1 First thing: Backup your scene.
2 Find a way to reliant reproduce the case. Something like “Click here, then move there, than do that, than that and finally quickly that.”

Excercise the steps a couple of time so you are sure you can reproduce the case. This will give you a way to ensure, that you actually got rid of the bug later. Also, most of the times you get a very good clue about where the problem could probably be.

Do not skip this step, its the most crucial one in reliable fixing bugs. Just poking around the code and some “mh… didn’t happen for some minutes… maybe my last change was the fix” is NOT a way of doing things.

3 Next step is to simplify your Scene and Code step-by-step until the error doesn’t happen anymore. Always follow the sub-steps:

  • Backup your scene again (some version control system is excellent here)
  • Do one of the two following things:

a) Remove lots of stuff where you either think “that’s most probably never ever influence the bug”. Then verify that the bug is still present. If not, restore to last backup.

b) Remove very few things where you think “that will probably make the problem go away” and check whether the bug is really gone now. If not, restore to last backup.

  • rinse and repeat

4 After a while, you will have a very good and small test case scene for the crash and in 99% of the cases you know exactly where the problem may be.

5 Now restore to your original scene and fix the bug.

6 Finally test whether its really gone.

7 If its a bug in unity (more often than you might think :frowning: ), file a bug report for unity with your minimal scene attached.

PS: Sorry for the style. The Markup Language used here does not like structured lists…