码迷,mamicode.com
首页 > 其他好文 > 详细

Tags and Layers

时间:2014-06-28 16:00:08      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   strong   

Tags and Layers

1、tags and layers 配置面板。"Edit" -> "Project Settings" -> "Tags and Layers"来打开设置面板。

  bubuko.com,布布扣

2、tag可以理解为一类元素的标记,如hero、enemy、apple-tree等。通过设置tag,可以方便地通过GameObject.FindWithTag()来寻找对象。

  bubuko.com,布布扣

  GameObject.FindWithTag()只返回一个对象,要想获取多个tag为某值的对象,GameObject.FindGameObjectsWithTag()。

  bubuko.com,布布扣

  可以在Inspector中设置tag。一个对象只能有一个tag

  bubuko.com,布布扣

3、sorting layer

  Unity uses the concept of sorting layers to allow you to divide sprites into groups for overlay priority. Sprites with a sorting layer lower in the order will be overlaid by those in a higher sorting layer. Sometimes, two or more objects in the same sorting layer can overlap (eg, two player characters in a side scrolling game). The order in layer property can be used to apply consistent priorities to sprites in the same layer. As with sorting layers, the rule is that lower numbers are rendered first and can be obscured by the higher numbers rendered later.

4、Layers

  Layers are most commonly used by Cameras to render only a part of the scene, and by Lights to illuminate only parts of the scene. But they can also used by raycasting to selectively ignore colliders or to create collisions.

  在inspector中可以设置layer

  bubuko.com,布布扣

  在Camera的Culling Mask中可以设置渲染哪些Layers。

  bubuko.com,布布扣

  意即,在使用过程中,使用Culling Mask、Layer Mask的地方实际指的就是layer。

 

Tags and Layers,布布扣,bubuko.com

Tags and Layers

标签:style   blog   http   color   使用   strong   

原文地址:http://www.cnblogs.com/tekkaman/p/3798135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!