Jump to content
  • Advertisement
Sign in to follow this  
rogerdv

keep same visible are among all resolutions

This topic is 1055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im developing a 2d maze game for mobiles and PC, and I want to keep the same visible area, no matter whats the screen size/resolution. I want to display NxM maze cells, but I found that in game preview, if I change the resolution, the visible area changes. How can I solve this? Currently Im using an ortho camera on top of the maze.

Share this post


Link to post
Share on other sites
Advertisement

Hi rogerdv,

 

If you're using a container canvas for the scene, and that canvas is using a screen space render mode, try setting the Canvas Scaler UI Scaler Mode to Constant Pixel Size.

 

I hope this helps!

Share this post


Link to post
Share on other sites
Note that if you have resolutions of different aspect ratios, it is impossible to display exactly the same number of cells unless you skew the cell sizes. You'll end up with a partial row or column of cells if you scale them up or down to suit the new resolution.

Share this post


Link to post
Share on other sites

Not Unity specific, but the best way to do this is to scale up until one axis hits the edge, and cover the rest with black bars(or whatever).  It can be a general system, which would work both landscape and portrait, though would obviously work better one or the other unless you have a perfect square size.  The method of scaling depends on the engine(in your case Unity) but the concept in general applies to all engines.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!