- Home /
Unity 2D - static camera, static background
How to create a very basic and static 2D scene with unity ? Almost everywhere in the web, all tutorials talk about simple examples with parallax backgrounds, multilevel games, etc. I want to know how can we create:
A very basic square scene with
for example, one sprite as background and
one camera covering only the square background and nothing else.
PS: All my attempts finished with the camera showing the square but with blue field around it.
PS: The camera does not need to follow anything, in fact all animations or interactions tend to be in the only one square field in the scene.
PS: I am a newcomer to the Unity world.
You can scale the square to take up the entire space of the camera by selecting the square and hitting "r" and then dragging on the boxes to scale it properly.
The problem is that the camera space seems to be only rectangular.
Try posting a picture of your problem, because it sounds like you should be able to just scale your background to fit the camera.
I didn't actually watch this video, but It seems like it could be useful?
https://unity3d.com/learn/tutorials/projects/space-shooter/adding-a-background
Answer by koray1396 · Mar 29, 2014 at 12:53 PM
blue area is unavoidable, if you play a square game on a rectangular screen, what should it show for the remaining areas? You can put some black background behind, so that would give you your square, and some black areas instead of blue.
you can try to set camera.aspect to 1. You can do this with a script attached to the camera. However, if you play this on a rectangular screen, the game will be stretched, and will look ugly.
You may want to check scripting reference for these.
https://docs.unity3d.com/Documentation/ScriptReference/Camera.html
Thx for your answer. So, is it possible to replace the blue color by a background image ?
Yes you can change it from settings (player settings, not sure). But i think it would be better to put an object with black texture. You can put it back by changing the z position.
Your answer
Follow this Question
Related Questions
Move the camera in 2D when target reaches bounds. Is there a better way? 0 Answers
Get mouse position relative to camera 2 Answers
Camera Shaking Problem 0 Answers
Particle System 2D dont works in Game 0 Answers