Tags and Layers

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

  

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

  

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

  

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

  

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

  

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

  

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

Tags and Layers的更多相关文章

  1. 【Unity3D游戏开发】基础知识之Tags和Layers (三二)[转]

    Tags和Layers分别表示是Unity引擎里面的标签和层,他们都是用来对GameObject进行标识的属性,Tags常用于单个GameObject,Layers常用于一组的GameObject.添 ...

  2. [Unity2D]Tags和Layers

    Tags和Layers分别表示是Unity引擎里面的标签和层,他们都是用来对GameObject进行标识的属性,Tags常用于单个GameObject,Layers常用于一组的GameObject.添 ...

  3. 【Unity3D】Tags和Layers

    Tags和Layers分别表示是Unity引擎里面的标签和层,他们都是用来对GameObject进行标识的属性,Tags常用于单个GameObject,Layers常用于一组的GameObject.添 ...

  4. Unity3D-第一视角射击游戏

    一.新建关卡 File,Save Scene,File,New Scene,File,Save Scene as... ,Level02.unity 1.建立场景 从Assets中拖放场景模型到Hie ...

  5. Unity3D Layer要点

    简介         Layer可以用于光照的分层和物理碰撞的分层,这样可以很好地进行性能优化 数据结构         Layer在Unity中有3中呈现方式:1.string名字,2.int层索引 ...

  6. 在Unity中实现小地图(Minimap)

    小地图的基本概念众所周知,小地图(或雷达)是用于显示周围环境信息的.首先,小地图是以主角为中心的.其次,小地图上应该用图标来代替真实的人物模型,因为小地图通常很小,玩家可能无法看清真实的模型.大多数小 ...

  7. Unity 2D游戏开发教程之游戏中精灵的跳跃状态

    Unity 2D游戏开发教程之游戏中精灵的跳跃状态 精灵的跳跃状态 为了让游戏中的精灵有更大的活动范围,上一节为游戏场景添加了多个地面,于是精灵可以从高的地面移动到低的地面处,如图2-14所示.但是却 ...

  8. UNITY VR 视频/图片 开发心得(二)

    上回说到了普通的全景图片,这回讲真正的VR. 由于这种图片分为两部分,所以我们需要两个Camera对象以及两个球体.首先新建一个Camera对象,并将其命名为RightEye(其它名字也无妨,只要你自 ...

  9. Unity射击游戏实例—物理碰撞的实现

    前言: 这一篇章实现物理碰撞,就是游戏体碰撞减装甲,这几天想要试着做出兼具装甲与血量的模式,可自动回复的装甲与永久损伤的血量,在一些平台上找到了不少有意思的模型,有兴趣的可以自己找找模型替换一下. 射 ...

随机推荐

  1. 敏捷开发之scrum模型

    什么是敏捷开发? 敏捷开发(Agile Development)是一种以人为核心.迭代.循序渐进的开发方法. 怎么理解呢?首先,我们要理解它不是一门技术,它是一种开发方法,也就是一种软件开发的流程,它 ...

  2. 基于Photon 的 PUN+ 如何自动实现RPC呼叫的.

    基于Photon 的 PUN+ 如何自动实现RPC呼叫的. 简单说函数标记成 RPC 类型的. void Hello() { Debug.Log("Hello"); PhotonV ...

  3. 给Java新手的一些建议——Java知识点归纳(Java基础部分)

    写这篇文章的目的是想总结一下自己这么多年来使用java的一些心得体会,主要是和一些java基础知识点相关的,所以也希望能分享给刚刚入门的Java程序员和打算入Java开发这个行当的准新手们,希望可以给 ...

  4. Linux 工具套件 —— binutils、readelf

    readelf:Linux 下专门针对 ELF 文件格式的解析器: 0. binutils GNU Binutils gnu binutils 一套二进制工具的集合,主要包含:ld(gnu linke ...

  5. JavaScript例子

    模态框(JavaScript) <!DOCTYPE html> <html lang="en"> <head> <meta charset ...

  6. node.js之npm库

    npm库安装可分为本地安装和全局安装,本地安装如下: npm install <Module name> 但是好像会出问题,官方貌似推荐全局安装,so 全局安装官方所给命令如下: npm ...

  7. Android UI之LinearLayout详解

    ※※※摘自http://www.cnblogs.com/salam/archive/2010/10/20/1856793.html LinearLayout是线性布局控件,它包含的子控件将以横向或竖向 ...

  8. python3 selenium 安装以及验证

    1. 相关链接 官方网站:http://www.seleniumhq.org GitHub:https://github.com/SeleniumHQ/selenium/tree/master/py ...

  9. 在oracle里,如何取得本周、本月、本季度、本年度的第一天和最后一天的时间

    在oracle里,如何取得本周.本月.本季度.本年度的第一天和最后一天的时间 --本周 select trunc(sysdate,'d')+1 from dual; select trunc(sysd ...

  10. 洛谷 P1227 [JSOI2008]完美的对称

    传送门 题目大意:求一些点集的公共对称中心 题解:对称中心是可以确定的,再判断. 代码: #include<iostream> #include<cstdio> #includ ...