Project slows down the more times I play it

#1

At the beginning of my project, I generate 32 clones of a Clip to use as particle effects. This runs fine the first time I try it, but the more times I run my project, the longer it takes for the whole project to start up. Clicking the play button has a very noticeable delay until the project actually starts. If I’ve had the browser up for a while, Firefox even says a script on the webpage is slowing down my browser until the game loads.
When I restart my browser, the lag goes away and the cycle starts again.
Maybe Wick isn’t clearing out or overwriting my clones, but constantly creating new ones?

EDIT:
Here is the code attached to sparkle, the object that caused the slowdown:

//randomize timing and transform
this.gotoAndPlay(random.integer(1,180));
var scale = random.float(0.5,1);
this.scaleX = scale;
this.scaleY = scale;
//this.rotation = random.integer(0,359);
var side = Math.random();
var halfPW = project.width/2;
this.x = side < 0.5 ? random.integer(0, halfPW-100) : random.integer(halfPW+100, project.width);
this.y = random.integer(50, project.height-180);
Clip.gotoAndStop(random.integer(1,2));

onEvent('load', function () {
    if (this.identifier === "sparkle") { //only the leader
        for (var i = 0; i<32; i++) {
            var myClone = this.clone();
        }
    }
});

I just realized that the fact that I have var myClone = this.clone(); inside the loop might be causing many myClone’s to clog up memory. I’ll try changing it to this.clone();

Edit: I think that fixed the issue.
EDIT 2: This did not fix the issue, it’s still happening. Darn :frowning_face:
Saving and autosaving are very slow as well.

1 Like

Null reference and gotoAndStop() bugs
#2

This happened with me too in the Legacy editor!
It seems to be a issue that carried over.
The longer you play it the slower it keeps getting.
My browser has even crashed before…
Edit:
Just read through the rest and I think our issues might be
slightly different.
But the problem arising is the same.

1 Like