Some sorta issue with my parallax background(s)

Hey everyone,

I’m getting a bit of an issue with a little practice game I’m making. I thiiiink it’s related to inefficient or incorrectly-written code but if it’s a performance thing and I’m being a bit ambitious please lemme know.

So I’ve got this fairly simple endless-runner kinda game I’m working on, sorta based off Ray Wenderlich’s tutorial (this one, it’s actually really handy) but have written my own code where it has 6 layers of parallax backgrounds behind the main scene. The foreground seems to run quite smoothly (I can’t detect an FPS drop, I don’t think) but the backgrounds are a bit… jumpy? Perhaps? and when deployed to Android it seems to be even more so.

The way they’re set up, each parallax layer is a script attached to the player gameObject with an array of gameObjects attached, calculating each prefab width with the localScale.x of its boxcollider. There’s probably a better way but I haven’t been able to work it out.

Anyways, yeah. Does that make sense? Can anyone shed any light on this?

I don’t know if this will help - but I just watched a parallax tutorial and even though it’s code - and I’m not a coder - I found the logic very understandable. It’s different than how you have your scene setup, and slightly dated, but it could be useful for you as well.