Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to make background in 2D sapce sandbox game

Discussion in '2D' started by Wrymnn, Sep 27, 2014.

  1. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    Hello

    I have been wondering how to make background in Top Down 2D game.

    The camera is ofc following player. And my options were:

    Make huge plane 10000x10000 and put there repeatable background. But that would be kinda stupid right, it is big, not good for performance and I would be always selecting background instead of my objects.....

    Another thing would be some kind of scrolling background that only camera would see. But how would I make it?
    Also there are skyboxes like here but it is sooooo horrible because you can clearly see that its just rotating sphere and it looks just horrible.
    Link to Sphere Skybox

    And I haven`t found any other tutorials about this problem.

    Please, do you have any solution for this? Would really appreciate any help.
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    If you have a camera which renders the sky sphere, but set to orthographic projection, does it flatten it out so it doesn't look spherical?

    as for a huge background that repeats, not really a problem... no issue on performance, it all boils down mainly to pixels that are visible getting rendered only. .. change your physics layers to avoid it being part of your ray casts?
     
  3. LiberLogic969

    LiberLogic969

    Joined:
    Jun 29, 2014
    Posts:
    138
    Why not attach a basic "starscape" sprite to your camera and then place a bunch of "fringe" sprites spread out within the bounds of your scene. The "fringe" sprites would of course have transparent backgrounds and remain motionless. You could layer them in between the "starscape" sprite and the camera so it appears as an overlay. They could be distant galaxies, planets, asteroids, gas clouds, etc. I guess it could look a little off with the parallax like effect but its not really hard to experiment with. Also, in the top right corner of the Unity editor there is a drop-down Layers box. When you click on it all the layers you have created will be there and next to them is a small faint 'lock' icon. If you click that icon so its locked you wont select any objects on that layer. This Is very helpful for scenes with huge backgrounds. Just lock the layer that contains those large sprites and you wont have to worry about selecting it every 2 seconds :)
     
  4. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    Hehe ofc thanks about that lock I will certainly use that! :D

    Yeah I will try to experiment a bit with the camera sprite background and see how it looks.

    Also found a video about infinite starfield background effect. So far it works but don`t know how to make layers out of it, so one bunch of stars is moving faster than the other since they use Perspective camera where I have to use Ortographic for 2D.


    If I switch it to Orthographic it shrinks and looks horrible. And ofc I can`t use perspective so not sure skybox will work.