在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. Css文字特效之text-shadow特效

    今天总结一下文字特效text-shadow,如果用好它可以做出各种不一样的效果,下图是我做出的几种效果. 怎么样,看起来很不错吧,下面贴代码. /* css */ p{ width:300px; ma ...

  2. UtilDev Web Server Pro

    A good tool for asp.net hosting: http://ultidev.com/products/UWS-Cassini-Pro/

  3. Python: PDB命令

    1. where(w) 找出当前代码运行位置 2. list(l) 显示当前代码的部分上下文 3. list <line number> 显示指定行的上下文 4. list <lin ...

  4. Volley网络连接

    一.Volley a burst or emission of many things or a large amount at once Volley是Android平台上的网络通信库,能使网络通信 ...

  5. IOS之未解问题--给UITableView提取UITableViewDataSource并封装瘦身失败

    前言:阅读了<更轻量的 View Controllers>,发现笔者这个优化重构代码的想法真的很不错,可以使得抽取的UITableViewDataSource独立写在一个类文件里,并且也写 ...

  6. Swift面向对象基础(上)——Swift中的类和结构体(下)

    学习来自<极客学院> import Foundation class User { var name:String var age:Int init(name:String,age:Int ...

  7. javascript 调试技巧

    不用alert,用console.log() <!DOCTYPE html> <html> <head> <script type="text/ja ...

  8. MongoDB 初识1: 启动MongoDB

    Mongodb可作为网络服务器运行,客户端可连接到该服务器并执行操作. 1. 首先,用户必须下载Mongodb并解压,运行mongod命令启动实例 下载地址:http://www.mongodb.or ...

  9. MySQL数据库初识(一)

    MySQL是一种免费的小型关系型数据库,与Linux.Apache/Nginx.PHP一起组成了WEB开发的黄金搭档. MySQL是C/S(客户端/服务端)体系结构的软件,而在开发中,PHP承担起了客 ...

  10. org.dom4j.documentexception异常

    org.dom4j.documentexception 解决: 设置xml文件编码格式:<?xml version="1.0" encoding="UTF-8&qu ...