- Home /
Game Crashes on iOS occasionally when instantiating/destroying objects, and sometimes when enabling/disabling objects
Our game is somewhat-sporadically crashing during gameplay, and I’m having trouble identifying why. The crash occasionally occurs during an event which includes instantiating and destroying objects, so perhaps it has something to do with garbage collection? I don’t know. On rarer occasions it occurs when enabling and disabling objects. I'm having trouble consistently reproducing the crash, but it will always happen during an attempt to do a full play through. I’ve checked the console in Xcode to identify the issue, but have had no success. Here's a screenshot of the last thing Xcode had to say before it crashed. (No snippet sorry).
I'd appreciate any help or direction anyone can provide and will be glad to provide more information. Just let me know. =)
A crash can happen because of one spare comma in a script. I'd check scripts ins$$anonymous$$d of accusing collections. Debug.Log is your helper
Hmm. If that were the case the crash should happen consistently though, shouldn't it?
Not necessarily. You're not using Touch in Editor. And considering your logScreen, Touch stuff is the issue
Could you also reproduce the crash in the unity editor in test mode or does it only happen on iOS?
It only happens on iOS. It never happens in the Editor, or on PC/$$anonymous$$ac.
Answer by surfuay · Apr 05, 2019 at 03:06 PM
yeah i've noticed the editor is very willing to "let things go" this would happen a lot to me in the early stages of an android game. It wasn't consistent either. It would require a very specific set of occurences in the full play and I couldn't trace it to any one thing. It turned out to be little things in my code that needed rewritten for hierarchical purposes or just altogether written to throw the method as much as it was. ie I had to change a few items from Update to being called in certain instances.
your code is "fine" cause it runs, it may just be an issue of cleaning up some of the more RAM intensive parts