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
asked Mar 23 '10 at 01:43 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.
answered Mar 23 '10 at 06:23 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.
answered Mar 23 '10 at 05:24 PM
I have problems with de staticbackground.cs in unity 3 .How is possible?has Someone the same problem?
answered Oct 25 '10 at 12:17 AM