Hello everyone, I have a strange bug and I can’t figurate why :
Sometimes, I have a scene which makes the game (on android) OR the editor crashes. It happens more on Android (barely 1/2 launch), on PC Editor, something like 1/10.

I’ve no infinite loops, no recursive functions, I dont really know where I can find a solution here so I’m looking for ideas here.

It’s a 2D project, with, at the load of the scene, 41 game objects (with UI in count), with 12 of them which have polygon colliers 2D with an average of 150 points each (275 max, 45 min).
They are all in the scene (no load in-game) and are cloned as obstacles.

I was able to let the program run during the crash, and sometimes data appear in the profiler, but not enough to really understand what’s going on. I probably can let the game continue to freeze and get more, but it takes me already 30 min of crash to get that and I don’t have the time to get more.

In those datas, I can see the Physics2D.Fixedupdate going mad (maybe? I don’t know if the datas are normal or not).

So I was thinking about the number of points in PolygonColliders are maybe a little high, but before I start messing with them, I want to know what you think about.

Hope you’ll have some ideas here :).
Thank.

Here’s the (poor) logs and data I was able to get before freeze.

Windows CPU (%) and Ram consumption of Unity:

53094-ucapture2.png

Profiler datas (during crash) going mad (maybe):

Edit :

Profiler datas when the game run correctly :

Editor.log:

Mono: successfully reloaded assembly
- Completed reload, in  0.600 seconds
Initializing Unity.PackageManager (PackageManager) v5.1.1 for Unity v5.1.1f1

Setting Android v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\androidplayer

Setting BlackBerry v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\blackberryplayer

Setting BB10 v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\iossupport

Setting StandaloneLinux v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\linuxstandalonesupport

Setting StandaloneOSXIntel v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\macstandalonesupport

Setting WSAPlayer v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\metrosupport

Setting SamsungTV v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\stvplayer\STVPlayer

Setting WebGL v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport

Setting StandaloneWindows v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\windowsstandalonesupport

Setting WP8Player v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\PlaybackEngines\wp8support

Setting GUISystem v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\UnityExtensions\Unity\GUISystem

Setting UNetHLAPI v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\UnityExtensions\Unity\Networking

Setting UnityAnalytics v5.1.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\UnityExtensions\Unity\UnityAnalytics

Setting IL2CPP v0.10.1 for Unity v5.1.1f1 to F:\Program Files\Unity\Editor\Data\il2cpp

Registering platform support modules:

Platform assembly: F:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.Compiler.dll (this message is harmless)
Platform assembly: F:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.dll (this message is harmless)
Platform assembly: F:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.Parser.dll (this message is harmless)
Platform assembly: F:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\UnityScript.Lang.dll (this message is harmless)
Registered platform support modules in: 0.0340965s.

Native extension for OSXStandalone target not found
Native extension for WindowsStandalone target not found
Native extension for LinuxStandalone target not found
Native extension for WebGL target not found
Native extension for SamsungTV target not found
Native extension for BlackBerry target not found
Native extension for Android target not found
Load scene 'Temp/__EditModeScene' time: 43.425041 ms 
You're deaaaaaaaaaaad
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Game:setGameOver(Boolean) (at Assets\Game\Scirpts\Game.cs:140)
Birdy:declareGameOver() (at Assets\Game\Scirpts\Birdy.cs:49)
Birdy:OnTriggerEnter2D(Collider2D) (at Assets\Game\Scirpts\Birdy.cs:65)
 
(Filename: Assets/Game/Scirpts/Game.cs Line: 140)

Unloading 176 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 2.724040 ms
System memory in use before: 148.3 MB.
System memory in use after: 148.5 MB.

Unloading 15 unused Assets to reduce memory usage. Loaded Objects now: 2574.
Total: 2.709272 ms (FindLiveObjects: 0.122116 ms CreateObjectMapping: 0.029535 ms MarkObjects: 2.540298 ms  DeleteObjects: 0.016755 ms)

You're deaaaaaaaaaaad
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Game:setGameOver(Boolean) (at Assets\Game\Scirpts\Game.cs:140)
Birdy:declareGameOver() (at Assets\Game\Scirpts\Birdy.cs:49)
Birdy:OnTriggerEnter2D(Collider2D) (at Assets\Game\Scirpts\Birdy.cs:65)
 
(Filename: Assets/Game/Scirpts/Game.cs Line: 140)

[remote] error: Init socket failed
The profiler has run out of samples for this frame. This frame will be skipped. Increase the sample limit using Profiler.maxNumberOfSamplesPerFrame
 
(Filename: C:/buildslave/unity/build/Runtime/Profiler/ProfilerImpl.cpp Line: 383)

The profiler has run out of samples for this frame. This frame will be skipped. Increase the sample limit using Profiler.maxNumberOfSamplesPerFrame
 
(Filename: C:/buildslave/unity/build/Runtime/Profiler/ProfilerImpl.cpp Line: 383)

The profiler has run out of samples for this frame. This frame will be skipped. Increase the sample limit using Profiler.maxNumberOfSamplesPerFrame
 
(Filename: C:/buildslave/unity/build/Runtime/Profiler/ProfilerImpl.cpp Line: 383)

More info : http://forum.unity3d.com/threads/polygoncollider2d-issues.351200/

Okay, my bad, it was an Unity issue fixed at the 5.1.3 (mine was 5.1.1, didn’t notice I was late).

http://issuetracker.unity3d.com/iss...2d-teleports-it-to-00-when-entering-play-mode

If i open the profile one time, then profiler jams, and I always get this error randomly when playing:
“The profiler has run out of samples for this frame. This frame will be skipped. Increase the sample limit using Profiler.maxNumberOfSamplesPerFrame”
At the first run with profiler. Everything is OK.
After this, I close the profiler window.
Every new play crash with this error. I can’t STOP the profiler. I remove the record, i close the window, but the profiler jams. It always try to work, slow down the project, etc. I always have to restart the unity after the profiler.

If someone happen to have the same issue a manage to get a workaround (I’m using Unity 5.4.1 and it still has this issue). Since I wasn’t able to get it to work I moved the asset folder into a new folder and opened it as a new project. After that I didn’t even try to open the profiler tab, because I noted that as soon as you open the tab, the error will happen again after you build your project.

I know it’s not the perfect solution, but I managed to keep building my game without any crash.

Hope it helps.