在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的计算公式的更多相关文章

  1. html始终让元素居中显示,背景图铺满随便拖动不出界

    首先.写两个class属性 body { margin: 0; padding: 0; height: 100%; width: 100%; background-image: url(../Cont ...

  2. background 背景图铺满界面

    background <body background="/image/1.png" style=" background-repeat:no-repeat ; b ...

  3. ExtJS-Viewport背景图片铺满浏览器视图并自动伸缩

    var viewport = Ext.create('Ext.container.Viewport', { style : 'background-image:url(login_bj.jpg);ba ...

  4. IE9以下通过css让html页面背景图片铺满整个屏幕

    第一种方法不设为背景图片,通过css来控制样式,可兼容到IE6,代码如下: <!DOCTYPE html> <html lang="en"> <hea ...

  5. css 设置背景图片铺满固定不动

    #page{ position: relative; width: 100%; height: 100%; background-image:url(../img/bg.JPG); backgroun ...

  6. css 背景图片铺满

    body { width: 100%; height: 100%; background: url(img/loginbg.png); background-size: 100% 100%; back ...

  7. css 设置body背景图片铺满

    background-image: url(../../../assets/images/workflow/work.png); background-repeat: no-repeat; backg ...

  8. [转]完美的背景图全屏css代码 – background-size:cover?

    写主题样式的时候经常会碰到用背景图铺满整个背景的需求,这里分享下使用方法 需要的效果 图片以背景的形式铺满整个屏幕,不留空白区域 保持图像的纵横比(图片不变形) 图片居中 不出现滚动条 多浏览器支持 ...

  9. css设置全屏背景图,background-size 属性

    在写主题样式的时候经常会碰到用背景图铺满整个背景的需求,这里分享下使用方法 需要的效果 图片以背景的形式铺满整个屏幕,不留空白区域 保持图像的纵横比(图片不变形) 图片居中 不出现滚动条 多浏览器支持 ...

随机推荐

  1. 论元数据和API管理工具

    公司里面的很多部门都在广泛的采用元数据管理,也采用了公司内部开发的元数据管理工具,有些部门的实施效果一直非常好,而有些部门的效果则差强人意.这个问题,其实和软件系统开发完成进入维护阶段后成本居高不下的 ...

  2. mysql乱码以及Data too long for column全解(最完整实用版)

    今天系统升级,开发.测试说本地环境.测试环境都没有问题,都用ssh client升的,演示环境报错了Data too long for column. 仔细检查了下,表字符集都是utf-8,目测长度肯 ...

  3. SAP技术相关Tcode

    ABAP的常用tcode 开发----------------------------------------------- SE51  屏幕制作 SE91  MESSAGE OBJECT SE80  ...

  4. SharePoint 2013 内容部署功能简介

    在之前的项目中,当客户有新的需求的时候,我们通常在测试环境上开发或者实施,然后手动在生产环境再弄一次.当发现内容部署这个东西,才知道这样是多么不合理的.我们可以创建两个网站集,一个用来修改,然后通过计 ...

  5. SharePoint 2010 External List Paging – Server Side

    http://lightningtools.com/bcs/sharepoint-2010-external-list-paging-server-side/ When you are using a ...

  6. 3.0之后在LinearLayout里增加分割线

    android:divider="@drawable/shape"<!--分割线图片--> android:showDividers="middle|begi ...

  7. android 打包错误

    打包时报如下错误: Export aborted because fatal lint errors were found. These are listed in the Lint View. Ei ...

  8. GCD编程 之 略微提高篇

    额外任务:学习YouXianMing封装好的GCD源码   1.GCD串行队列与并发队列   串行队列一次只执行一个线程,按照添加到队列的顺序依次执行 并发队列一次可以执行多个线程,线程的执行没有先后 ...

  9. SAM4E单片机之旅——16、NAND Flash读写

    这次大概介绍了一下NAND Flash,以及在ASF中使用它的方法. 一. 接线 这个开发板搭载了一个256 MB,8位的NAND Flash(MT29F2G08ABAEA).引脚接线如下: 偷个懒, ...

  10. Effective Java 28 Use bounded wildcards to increase API flexibility

    Get and Put Principle PECS stands for producer-extends(? extends T), consumer-super(? super T). For ...