Unity Wont Build Game Right

Please watch the video for the full problem:

I’m not a master with building, but that’s a memory error.

Computers work when programs ask something known as the “Kernal” for memory. The Kernal will then grab a piece of open memory and say “Here you go program, knock yourself out.”

Sometimes however, the Kernal can grab a piece of memory that you don’t have access to (it’s being used by another program, you’ve gone over your allocated memory for one program, etc).

So without a ton of knowledge on your project. I’ll make a few suggestions.

The first being to rebuild the game, there might have been an error in the build.

The second being try to Run As Administrator when you start the game.

The 3rd and most painful being that you may be using up too much system memory (also, if you set it to Realtime, it will crash anyway, never set a program to Realtime, High Priority is more than enough.)

If this is the case, you need to optimize your game.
Check for excess colliders, rendered objects (if you have a ton of trees this will slow your game a lot, check for lighting (lights slow down your game a lot) if you have Pro and are using Shadows, consider light mapping the game (shadows are SUPER EXPENSIVE), if you have loops in your scripts they can cause memory bugs and slow the game as well.

Also, try out Occulusion Culling, there should be tutorials all over. The gist of it though is that you set any objects that aren’t going to move (aka buildings, lamp posts, benches, etc) to be “static” (top right of the inspector) and then use Occlusion Culling (Bake the Scene) and the game will know not to render anything it is not seeing. You can use Occlusion Areas to achieve the same effect on moving characters or objects such as NPC’s, etc.

Ok it’s nothing to do with your specific RAM. An access violation means that some code was trying to read memory that it has no access to (for example if the program tries to read memory that it hasn’t allocated for itself - this is a protection mechanism). So there is an error somewhere. From the crash log you showed in the video, the crash is happening in the Unity executable. Why this is happening I can’t tell from the overview that you presented, but the crash.dmp can be used with Visual Studio to get more clues. Also you should probably have a log file unless you turned that off in your player settings.

If you build a development build and enable the player log then you should look for clues toward the end of that log file. It might not be enough to isolate the problem. What you otherwise can do to narrow down on the issue is to put some Debug.Log in your collider code (it appears to crash as you collide with the terrain) and see if you enter and exit the collision callback correctly. Or more properly, you could debug it with MonoDevelop and step through the code to find the area of the crash and try to figure out why it crashes.

If you need help figuring out the cause of the crash (if you can’t figure it out yourself with Debug.Log or MonoDevelops Debugger), you could post the player log file and crash folder contents so it is easier for us to view. But I recommend that you try and figure it out yourself first as I think you’ll learn a lot from it, and you seem like a smart guy who likes to solve things for yourself. Debugging is a really good skill to learn.