Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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.

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

How can I make my "Squat" button register with just a press? 1 Answer

I don't know how to ground check the player 3 Answers

Button doesn't react properly 0 Answers


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