Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
4
Question by RobF · Mar 23, 2010 at 01:43 PM · 2dgraphicsbackground

Background Bitmap

In the planning process for a game that has some hidden object 2D scenes, and something I thought would be quite easy is causing me some angst, putting a bitmap to the background of a scene.

I've thought about using a method described in this forum utilising a separate camera and layer for a gui texture of the background image. This however won't work, as the image won't resize on change of aspect ratio and I'm loath to restrict the games screen resolution as this annoys me when this is done on a game.

I thought there would have been a scripting option to replace the camera background colour with an image.

Anyway, if someone could point me in right direction it would be appreciated.

Thanks in advance. Rob F

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

3 Replies

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

Answer by Eric5h5 · Mar 23, 2010 at 06:23 PM

You don't need any scripting or anything...use a GUITexture for the background with a separate camera as you mentioned, and make sure the GUITexture has a scale of 1 on the X and Y axes, with 0 for all the pixel inset values. Since the scale uses viewport coords, 1 means it will always fill the screen regardless of resolution.

If you have Unity Pro, you can use the StaticBackground script on the wiki, which doesn't need multiple cameras.

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 RobF · Mar 23, 2010 at 10:18 PM 0
Share

Thanks Eric, great solution. The explanation about the viewport coords and xy scale was enlightening, thanks again.

avatar image
2

Answer by x4000 · Mar 23, 2010 at 05:24 PM

You probably should look at SpriteManager (which is free), or SpriteManager 2 (which is paid). Those are the two most painless ways for rendering 2D images in Unity. There is also a 2D Shooter tutorial which does something along the lines of what you want, with a separate camera for the background only.

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 RobF · Mar 23, 2010 at 10:22 PM 0
Share

I'll look a these thanks

avatar image
-1

Answer by manuelr · Oct 25, 2010 at 12:17 AM

I have problems with de staticbackground.cs in unity 3 .How is possible?has Someone the same problem?

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 Herman-Tulleken · Dec 14, 2010 at 01:05 PM 0
Share

Not an answer - use a comment.

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

No one has followed this question yet.

Related Questions

Background Image in a 2D game: problems of size/quality importing. What's the right workflow? 1 Answer

How can I unfocus and fade my background in a 2D game? 0 Answers

How would I go about constructing a layered scene? 2 Answers

Background not Crushed 1 Answer

2D Background texture flickering 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