0
\$\begingroup\$

In my Unity2d-platformer, I need background to follow the character, so I just attach it. And when character turn left from right (or right-to-left), background turn too.

How can I make my background constant?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Not exactly sure how you have your project set up but if your camera is following the player drop it on the camera instead. If you cannot achieve your result by doing that then drop a follow object script on it and target the players x position \$\endgroup\$ Commented Feb 5, 2015 at 15:05

3 Answers 3

1
\$\begingroup\$

Do not attach it to the character. An easy option would just be to have a script on the background that has it match the X position of the player transform.

\$\endgroup\$
0
\$\begingroup\$

Make a script that follows the cameras position or/and just make it a child of the camera depending on what you want to achieve. The script solution has the benefit of making it possible to make small adjustments depending on which direction the player is running.

\$\endgroup\$
0
\$\begingroup\$

I think you're looking for "Parallax Scrolling" http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/2d-scrolling-backgrounds

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .