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

Am I Being Delutional About This?

Discussion in 'Editor & General Support' started by renman3000, May 9, 2014.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
    As I am building for mobile, I am coming to an interesting realization. With the various screen resolutions and computing powers, I am finding myself customizing for each. Specifically, this..,,

    I originally built for a screen 960 in width. Sprites are all pixel perfect. As such, spacing is as it is. Enemies, traveling at a single speed, and are spaced apart by x units.

    As I am having to now build for a screen 2048 in width, to achieve pixel perfect, I am anticipating that I may have to rebuild the entire level for scratch as sprites will be much larger, need to be spread a part by a much larger factor and as such, need to travel at a faster speed to maintain the same feel as the 960.


    Am I being delusional about this. Someone please tell me a simple way about this.


    Thanks
     
  2. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    Nope, you don't need to rebuild. You just need to replace the sprites with bigger ones, and the appropriate PixelToUnit set on the larger ones, everything else can remain the same. You don't need to change the spacing or speed or camera or anything because everything is based on Units, not pixels. You may need to tweak the UI, or your screen space if your new target is widescreen.

    Typically you base things on height. if your current project is set up to 100pixels to units, just calculate the difference between that and your new target and you will have the new percent and size you need for the new art.

    lets say you are going from 960x640 to 2048x1536. You don't need to change anything in the game (again, unless needed for widescreen, though that is usually only UI unless you are specifically bordering elements or have fixed sizes). You are looking at about 2.44 larger art. If your sprite is 100x100, the new art will need to 244x244, and the PixelsToUnits would be 244. So will happen is that on the higher res screen your sprite will be 244x244, but will still take up 1 Unity unit in the game, just like in the smaller one.
     
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
    Right, but where I am confused, is the art.

    Would I just need an atlas, identical in proportion (exact same sprite layout), but double, or what have you in size?

    Also, we are talking about building up, from 960 to 2048, but what about the reverse? In my mind it seems that it would be impossible for a smaller sprite to fill the larger sprite. As such, should we always build from smaller resolutions, to larger?


    Thanks
     
    Last edited: May 9, 2014
  4. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    Really that depends on how you are getting your sprites into the game. If you are providing an atlas, you will need a new atlas at the new size. Or if they re files, new files.

    Nope the reverse works exactly the same. In fact it is more common to start with larger resolutions and build down. That way you are testing against the worst case scenario. If you start small and build up you could run into situations where memory is a problem. Starting larger, you will find that stuff right away, and it wont get worse when the size is reduced, it will improve.
     
  5. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
    Ok,
    Thanks,
    One issue I have tho, I am swapping out textures at start, if screen height = y use texture this. The issue is tho is that the texture, identical in the "old textures" sprite layout, only different in size, when placed in, the UVs do not line up at all.

    This is weird to me since they do if I swap textures by hand in the editor.


    Any tips?
     
    Last edited: May 10, 2014