Unity2D 背景图铺满与Camera.Size的计算公式
在unity制作2D游戏的教程,背景图sprite铺满显示时Camaer的Size调到多少合适,作个笔记。
资源参数
background.png 2048x640,Sprite的像素单位:100


调节camera.size
当camera的size=5,背景的显示效果


Camera的Size=3.2的背景的显示效果

计算公式
计算公式为:Screen Height/2/Pixel To Units=Main Camera.Size
对于2048x640的背景图,像素为100单位的比例,Camera的Size=640/2/100=3.2
For example, consider a Sprite imported from a 500 pixels wide image. The following table shows the different widths your GameObject would have when rendering that Sprite at different scales along the x-axis, using different values for Pixels to Units:

background.png is 640 pixels tall, and the background Sprite has a Pixel to Unit ratio of 100, so the backgroundobject in the Hierarchy will be 6.4 units tall. However, the orthographic camera’s Size property measures half the height of the screen, so it should be half the height of the background, in units, or 3.2.
Unity2D 背景图铺满与Camera.Size的计算公式的更多相关文章
- html始终让元素居中显示,背景图铺满随便拖动不出界
首先.写两个class属性 body { margin: 0; padding: 0; height: 100%; width: 100%; background-image: url(../Cont ...
- background 背景图铺满界面
background <body background="/image/1.png" style=" background-repeat:no-repeat ; b ...
- ExtJS-Viewport背景图片铺满浏览器视图并自动伸缩
var viewport = Ext.create('Ext.container.Viewport', { style : 'background-image:url(login_bj.jpg);ba ...
- IE9以下通过css让html页面背景图片铺满整个屏幕
第一种方法不设为背景图片,通过css来控制样式,可兼容到IE6,代码如下: <!DOCTYPE html> <html lang="en"> <hea ...
- css 设置背景图片铺满固定不动
#page{ position: relative; width: 100%; height: 100%; background-image:url(../img/bg.JPG); backgroun ...
- css 背景图片铺满
body { width: 100%; height: 100%; background: url(img/loginbg.png); background-size: 100% 100%; back ...
- css 设置body背景图片铺满
background-image: url(../../../assets/images/workflow/work.png); background-repeat: no-repeat; backg ...
- [转]完美的背景图全屏css代码 – background-size:cover?
写主题样式的时候经常会碰到用背景图铺满整个背景的需求,这里分享下使用方法 需要的效果 图片以背景的形式铺满整个屏幕,不留空白区域 保持图像的纵横比(图片不变形) 图片居中 不出现滚动条 多浏览器支持 ...
- css设置全屏背景图,background-size 属性
在写主题样式的时候经常会碰到用背景图铺满整个背景的需求,这里分享下使用方法 需要的效果 图片以背景的形式铺满整个屏幕,不留空白区域 保持图像的纵横比(图片不变形) 图片居中 不出现滚动条 多浏览器支持 ...
随机推荐
- Follow me to learn what is Unit of Work pattern
Introduction A Unit of Work is a combination of several actions that will be grouped into a transact ...
- netty Failed to submit an exceptionCaught() event异常
最近测试netty开发的服务端应用在关闭时,出现下列异常: ->###WARN#########nioEventLoopGroup-3-2###io.netty.util.internal.lo ...
- (八)play之yabe项目【身份验证】
(八)play之yabe项目[身份验证] 博客分类: 框架@play framework 添加身份验证 play提供了一个模块-Secure(安全模块),用来做身份验证 允许Secure模块 修改 ...
- C# Sqlite事务
在 C#中执行Sqlite数据库事务有两种方式:Sql代码和C#代码 1.Sql代码: BEGIN… COMMIT /ROLLBACK 2.C#代码: using (SQLiteConnection ...
- javascript-this,call,apply,bind简述1
最近在系统的学习面向对象方面的知识,遇到的最大拦路虎就数this的指向,call,apply,bind函数的使用,单独抽出一天时间把这几个烦人的家伙搞定,去学习更深入的内容. 首先介绍一下this的一 ...
- android assets文件夹资源的访问
1.assets文件夹里面的文件都是保持原始的文件格式 . 2.assets中的文件只可以读取而不能进行写的操作. 3.assets目录下的资源文件不会在R.java自动生成ID,所以读取assets ...
- Static Cell-静态TableView
使用静态TableView有两个前提,1.要在Storyboard上 2.需要使用TableViewController PS:如果需要设置不同的cell的高度不同的话,还是需要使用tableVie ...
- xib命名注意事项--防止被其他控制器意外地 当做默认的 view了
注意: 1.创建的xib如果不是想给指定的控制器做view的话,命名就要注意了! 2.最好是不要命名和控制器名字相关的xib. 如下举例说明一下: - (void)touchesBegan:(NSSe ...
- Orchard扩展 自定义后台管理导航菜单 Admin Menu
金天:学习一个新东西,就要持有拥抱的心态,如果固守在自己先前的概念体系,就会有举步维艰的感觉. 金天:看源码永远是Coder学习的最快捷路径. 看本文需要对Orchard大致体系, 特别是Mo ...
- virtualbox 安装 虚拟机的时候报错不能创建新任务
找到原因是因为自己的windows是破解的, 找到C:\Windows\system32\uxtheme.dll这个文件,我的破解的windows在这里自带了一个uxtheme.dll.backup的 ...