• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by TommyB · Feb 05, 2014 at 11:32 PM · 2d-platformer2dtexture

Static background image, camera follow player

Hi,

I'm relatively new to Unity and trying to work with some 2D examples. At the moment I'm working on an infinite runner example whereby the main camera follows my player. To make the game more interesting however, I want to set a static background. Now I have searched the forum and I know the usual answer is "this has already been answered, go here" http://answers.unity3d.com/questions/9729/how-can-i-display-a-flat-background-2d-image-not-a.html and believe me, I've tried the steps outlined in that a number of times, but my background image seems to render above my player.

All my cameras are on the "default" layer, and they currently both have the same z position of -10 (not sure if this is the issue, but I have tried changing these settings so they are on different z positions and on different layers but nothing seems to work) All the other settings seem to be correct as per the linked post. So can anyone suggest to me here what might be wrong? At the moment my player is just a default Sphere gameObject so I thought it might be lighting, but adding a sprite doesn't make any difference.

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by rutter · Feb 05, 2014 at 11:40 PM

When rendering multiple cameras, it's very important to set appropriate clear flags, culling mask, and depth.

Many setups render the "main" scene camera, first, before rendering additional passes over it, but in your case it sounds like it'll be rendering over the background. Keep that in mind when reading tutorials on multi-cam setups.

Clear flags tell a camera which sorts of information it should discard from the previously rendered frame. Cameras rendering over one another usually clear the depth buffer.

Culling mask tells a camera which layer(s) of GameObjects it should render. If there's any chance your cameras will ever see each other's scene objects, make sure they're rendering appropriate layers.

Depth controls the order in which your cameras are rendered (smaller values go first).

Finally, why not use a skybox? They're so easy.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TommyB · Feb 06, 2014 at 06:15 PM 0
Share

Thanks for this. Is wasn't aware of the SkyBox. Everything I'd searched for up to this point suggested the previous approach! It's one of those cases where you don't know what you don't know!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Dynamically setting sprite frames through code - Unity 2D 4.3 0 Answers

(Video link) 2d sidescroll runner, objects become blurry with speed. 3 Answers

Unity 2D - Game Collision Bug Error 0 Answers

Health Bar/Hearts? 2 Answers

2D Character won't jump diagonally 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges