- Home /
Problem with game resetting itself
I'm making a two player game with a lot of explosions with Add.ExplosionForce, particle effects and moving objects. The game works most of the time. But once in a while when the game heats up, the game reloads itself even if none of the players have scored.
Is there a limit to explosions and particle effects that the Unity engine can handle? I have 25 bombs per player per game level. I'm not sure if I'm causing an "overload" of some kind.
My draw calls range from 700 to a little over a thousand while the frame rate is a healthy 35 - 95 fps. I'm using an object pool for some of the projectiles but not on the particles. I haven't atlased my textures yet and simplified my models and these may resolve some issues.
I tried to prevent it from resetting itself before any player has scored by a few functions focused on one of the moving objects. It doesn't work like I thought it would.
Here's my code:
var object1 : GameObject;
function Awake ()
{
var goAhead : boolean = false;
}
function Update()
{
DonotLoad();
LoadLevel();
}
function DonotLoad()
{
if (object1.active == true && ringBell == false)
goAhead = false;
if (ringBell == false)
goAhead = false;
}
function LoadLevel()
{
if (goAhead == false)
return;
else if (goAhead == true)
Application.LoadLevel (1);
}
The code does not stop the game from resetting itself but just loads the level really fast when goAhead = true, because I guess I put it in the Update.
How can I properly code something like this? Or should I limit the explosions to some kind of maximum? Can this type of game, play well on the new iPad Retina?
Anyone's help and insight will be much appreciated.
Your answer
![](https://koobas.hobune.stream/wayback/20220613073124im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I overload operators in Unity Javascript 1 Answer
No Overload method problem 0 Answers
Calling a method of a class that is a part of another class? 1 Answer
Calling a function from another script issue 1 Answer
Why isn't there an overload method for EditorGUILayout.Toggle to toggleOnLabelClick? 1 Answer