soundFX causing crash in my game and how to avoid.
TwistedMech
Member Posts: 408
I have been having problems with my first level crashing on the iPad (not on Mac) with 0.9.0. I changed all spawn/destroy rules to activate on-screen hidden actors like bullets. For some reason the game would still crash on one of the screens where a turret fires bullets at the main character every 0.3 seconds. I thought the spawn/destroy would be the reason for the crash but was not.
I had the turret send a bullet toward the player every 0.3 seconds and play a laser-FX sound with “run to completion” checked. Unknown to me and only after spending many hours trying to figure out why the game would crash, it dawned on me that the EVERY 0.3 rule was looping or unable to complete its sound processing call return. If on a play sound, you have “run to completion” unchecked and the sound is 1 second long then you will only hear the first bit before the EVERY rule restarts.
The way to avoid this, is to add the laser FX sound to the laser (bullet) actor with “run to completion” unchecked because its life on scene should be long enough to hear the sound.
This will also apply to any nested timers where the inner timer exceeds the outer in time usage. This also explains the memory usage increase.
I had the turret send a bullet toward the player every 0.3 seconds and play a laser-FX sound with “run to completion” checked. Unknown to me and only after spending many hours trying to figure out why the game would crash, it dawned on me that the EVERY 0.3 rule was looping or unable to complete its sound processing call return. If on a play sound, you have “run to completion” unchecked and the sound is 1 second long then you will only hear the first bit before the EVERY rule restarts.
The way to avoid this, is to add the laser FX sound to the laser (bullet) actor with “run to completion” unchecked because its life on scene should be long enough to hear the sound.
This will also apply to any nested timers where the inner timer exceeds the outer in time usage. This also explains the memory usage increase.