Z-Index Causes Lag

Use this template to make awesome bug reports:

Your username: GravyStudiosNExT

What kind of device are you using?: iPad Mini 1

1 sentence description of the problem I was working on my project, and set a high z-index, and then the project lagged to the point that it crashed.

Steps that the Hopscotch team can take to reproduce my problem every time:

  1. Create a project with two objects.
  2. Set one’s z-indez to a very large number, such as 1000000. Also add some code so it is possible to see lag.
  3. Hit play.
    ….

I expected this to happen:
The project to run smoothly.
But instead this happened:
The project crashed. (White screen)
Here’s a sweet screenshot:
I don’t have a screenshot.

10 Likes

I made a project with 2 objects and 1 setting to a z index of 55050404664464614944 and fps was 62

5 Likes

Maybe it’s just an issue with old devices.
If I make a project with nothing except an fps detector I rarely get 60 fps, and with a high z index, I will only get 20-30.

5 Likes

Usually it’s around 60-61 (FPS) for me. I also think the bug might be because of old device.

5 Likes

That’s probably the most likely explaination cuz it lags on my iPad a lot too

7 Likes

Yep, HS seems to create a layer for every number until it reaches the highest number in the project.

So Z 10000 will create all 10000 layers, even if it’s the only Z Index, as opposed to something like 1 or 100.

6 Likes

One thing I don’t understand.

Why do you need to set an object to z-index 1000000?

5 Likes

If you want to make sure it’s always in the front.
Especially if you have 1000000 objects. (OK that part is far-fetched)

5 Likes

While game is playing - bring to front

5 Likes

That is literally what I do in my projects (every single text and object under the color picker of 2-in-1 Drawing Pad).

I use When 7 = 7.

3 Likes

The object limit is 4096, including clones, so maybe set it to 4096 instead.

3 Likes

Update on this:
While coding my HHC project, I had a circle that would set it’s z-index to 99999999. On trying to run the project, it would instantly freeze, and I wouldn’t be able to play it until I closed the project and opened it again.

5 Likes

Yeah and what I assume is the case is that whatever number you put in is how many layers are actually made, regardless of whether they’re used or not

2 Likes

Well that’s fun. Good to know

Yea, that’s how I fixed my seed game, it was running so slow b4

1 Like

I have hs on an iPad mini 1 also. Due to the age of the device, hopscotch can be laggy

1 Like

yeahh I never really use hs on my ipad mini 1

1 Like

Nor do i, especially on my ipad first gen

1 Like