GameObject
- active
- AddComponent.<T>
- AddComponent
- animation
- audio
- BroadcastMessage
- camera
- collider
- CompareTag
- constantForce
- CreatePrimitive
- FindGameObjectsWithTag
- FindWithTag
- Find
- GameObject
- GetComponent.<T>
- GetComponentInChildren.<T>
- GetComponentInChildren
- GetComponents.<T>
- GetComponentsInChildren.<T>
- GetComponentsInChildren
- GetComponents
- GetComponent
- guiTexture
- guiText
- hingeJoint
- isStatic
- layer
- light
- networkView
- particleEmitter
- renderer
- rigidbody
- SampleAnimation
- SendMessageUpwards
- SendMessage
- SetActiveRecursively
- tag
- transform
GameObject.layer 层
var layer : int
Description描述
The layer the game object is in. A layer is in the range [0...32]
Layers can be used for selective rendering from cameras or ignoring raycasts.
游戏物体所在的层,一个层的范围是在[0...32]之间。
层可以用于摄像机的选择性渲染或者忽略光线投射。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public void Awake() {
gameObject.layer = 2;
}
}
//把游戏物体放到忽略光线投射层
gameObject.layer = 2;
最后修改:2011年5月19日 Thursday 22:15