Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Unity crashing when I press play in the editor?

Tags:

c#

crash

unity3d

My game is crashing whenever I switch scenes and then press play in the editor. I am using this code to switch scenes:

enter image description here

...

enter image description here

I have tried disabling most of the scripts in my game to debug the problem but it freezes every time. I've also tried loading the levels without the co-routines but that doesn't help. I can continue playing the game as long as I don't use the editor controls, however things get pretty choppy and performance becomes terrible.

like image 443
LooMeenin Avatar asked Dec 01 '14 02:12

LooMeenin


People also ask

Why does my Unity keep crashing?

Unity Crash while playing the game can occur due to various causes such as service situation, network environment, and PC specifications. If this problem frequently occurs, please check the following. 1. Please double check to see if your PC meets the minimum gaming requirements for our game.

How do I recover a crashed unity project?

If you want to restore your crashed scene, you have to go to your project's directory (this is the folder that contains the Assets directory) then enter the Temp directory. You will find the __EditModeScene file within. This is your saved scene file.

What does unity crash handler do?

It sends data to the developer if they're using Unity Cloud Diagnostics. It also captures the dump file of the crash game and writes it to disk, even the game developer hasn't configured anything (so you could send it to them manually).

How do I get unity crash logs?

To view the Editor log, select Open Editor Log in Unity's Console window. On macOS, all the logs can be accessed uniformly through the standard Console. app utility. On Windows, the Editor log file is stored in the local application data folder <LOCALAPPDATA>\Unity\Editor\Editor.


2 Answers

First, look at the editor logs, quite possible that the reason of the crash will be there. If unsure, post them here (post on gist and link here).

Also, if you have unity pro (or a trial version of pro), try looking at the profiler's readings. On free you can also try looking at the Stats button from the Game window. Using too much memory (RAM or VRAM) can cause crashes.

like image 54
Krzysztof Bociurko Avatar answered Oct 08 '22 17:10

Krzysztof Bociurko


i was also having same problem. if your program is correct then just change the editor path to anything in unity hub and save, close unity hub, open again and set the path to previous one.

like image 28
Shubham Avatar answered Oct 08 '22 17:10

Shubham