Unity freezing and crashing randomly, unable to debug

Hey yall, earlier I posted this about a game that my group was making:

However, with a latest build, turns out that it crashes in builds, just a lot more rare than it does in the editor. I was able to get a crash log, but all the other fixes I found online seem to make no difference.

I am completely stumped. It seems to always happen whenever I am holding a weapon, namely the Umbrella or Smoke Bomb.

Here is our github page for our project

I am using some external DLL’s, but those make no difference to the game when I disable them. The problem also happened before we even added FMOD. I just don’t know what to do.

Copying all the assets and some project settings to a different project make no difference.

I just don’t know what this problem could be. Any help can be appreciated.

Edit: May as well add, whenever the game is frozen, it runs my CPU at 100% capacity. The thing is, the profiler doesn’t show anything before it. It confuses me.

I figured out the solution, it was due to some faulty code, but it still confuses me when I look back at it.

Basically, we have a mouse controller which uses an external DLL to control input for up to 4 mice. Inside of that, we determine the chance in mouse position, and move a reticle (now obsolete) to point towards where the player wants to aim.

This chunk of code was used to rotate a center body that would be holding any weapons or items the player picked up, to show how they are aiming it or moving as their view shifts. I can’t properly comment it, as the coder who wrote it did not discuss it that much with me.

center.LookAt(reticle.transform.position);
Vector3 rotation = new Vector3(0, 0, -center.localEulerAngles.x);
center.transform.localEulerAngles = rotation;
if(reticle.transform.position.x < player.transform.position.x) {
       center.transform.localEulerAngles += new Vector3(0, 180, 0);
}

So this code would be called at most 4 times every update function. I figured that rewriting the code without the LookAt() function would be best, since that is intended for 3D and our game is 2D.

firingVector = reticle.transform.position - center.position;
firingVector.Normalize(); //normalized for later use
float rotZ = Mathf.Atan2(firingVector.y, firingVector.x) * Mathf.Rad2Deg; //moving the rotation of the center here
center.rotation = Quaternion.Euler(0, 0, rotZ);

It still confuses me, because replacing this code inside each individual player would fix it. What is even more confusing is that this isn’t always 100% reproducible, since it could freeze from 0-30 seconds of using an item, and picking it up (setting it as the child of the center). So if anyone is stumbling across this and has any input or ideas of what this could be, that would be appreciated.