Good evening mates,
I’m working on a side scroller game, and I’m using a plane with a material as backgound. I need that this plane follow the player through the level, so I attacked a script on it.
This is the main part of the script:
There’s nothing wrong with your script.
In my opinion, that script seem overkill the purpose.
In update function, your script keep running, doing the logic (IF, !, ) and “new Vector3” all the time.
Think of the time and memory spend on it every frame.
Maybe think of different approach.
For example, try parent the “plane” to your player? (plane.transform.parent = player.transform)
Once the player dead / complete level, just remove the plane from parent.