我怎样才能code我的比赛工作在Android设备上的每一项决议? (使用Unity) [英] How can I code my game to work on every resolution of Android devices? (with Unity)

查看:123
本文介绍了我怎样才能code我的比赛工作在Android设备上的每一项决议? (使用Unity)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一场比赛我在小480x320的分辨率做(我已经在构建设置设置)的统一。不过,我想发表我的游戏,每分辨率每个Android设备。我该怎么办呢,告诉团结扩展我的游戏到设备的分辨率是多少?是否有可能呢?

I have a game what I made in 480x320 resolution (I have set it in the build settings) in Unity. But I would like to publish my game for every Android device with every resolution. How can I do it, to tell Unity to scale my game up to the device's resolution? Is it possible to do?

在此先感谢!

推荐答案

在回答你的问题在​​很大程度上取决于你如何实现的游戏。如果您在使用GUI纹理创造了它,那么它在很大程度上取决于你如何放置/大小的物体与屏幕大小,这使得事情有点棘手。

The answer to your question largely depends on how you've implemented the game. If you've created it using GUI textures, then it largely depends on how you've placed/sized your objects versus screen size, which makes things a little tricky.

如果你的大多数游戏使用对象(如飞机,立方体等)来实现,然后有两个方法,我通常选择使用。

If the majority of your game is done using objects (such as planes, cubes, etc) then there's two methods I usually choose to use.

1)第一种方法是很容易实现,但并不总是显得好看。你可以简单地改变相机的纵横比,以匹配一个你周围设计你的游戏。所以,你的情况,因为你已经在4设计你的游戏:3,你会做这样的事情:

1) First method is very easy to implement, though doesn't always look too good. You can simply change the camera's aspect ratio to match the one you've designed your game around. So in your case, since you've designed your game at 4:3, you'd do something like this:

Camera.aspect = 4f/3f;

不过,如果有人的演奏屏幕上意味着16:9,比赛将结束面色扭曲和拉伸

However, if someone's playing on a screen meant for 16:9, the game will end up looking distorted and stretched.

2)第二种方法是不容易,需要相当多的工作和计算,但会给出一个更简洁的寻找结果你。如果您使用的是正交相机,要记住一个重要的事情是,不管是什么屏幕分辨率被使用时,正视相机保持高度设定高度,只有改变宽度。例如,正视相机在10的尺寸,高度将被设置为2。考虑到这一点有什么你需要做的每个级别内补偿尽可能广泛的相机(例如,有广泛的背景)或动态地改变相机的正字大小,直到它的宽度相匹配,你所创建的。

2) The second method isn't as easy, requiring quite a bit of work and calculations, but will give a much cleaner looking result for you. If you're using an orthographic camera, one important thing to keep in mind is that regardless of what screen resolution is being used, the orthographic camera keeps the height at a set height and only changes the width. For example, with an orthographic camera at a size of 10, the height will be set to 2. With this in mind what you'd need to do is compensate for the widest possible camera within each level (for example, have a wide background) or dynamically change the Orthographic Size of the camera until its width matches what you've created.

如果你已经做了3D游戏与立体摄像头,屏幕分辨率应该不会真正影响它的外观,但是我想这取决于游戏,所以更多的信息,将要求

If you've done a 3d game with a stereoscopic camera , screen resolution shouldn't really affect how it looks, but I guess that depends on the game, so more info would be required

这篇关于我怎样才能code我的比赛工作在Android设备上的每一项决议? (使用Unity)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆