Unity GameObject Class
GameObject
class in UnityEngine
/
Inherits from:Object
Description
Base class for all entities in Unity scenes.
Note: Many variables in the GameObject class have been removed. To access, for example GameObject.renderer in csharp use GetComponent<Renderer>() instead. In JS script use GetComponent.<Renderer>().
See Also: Component.
Variables
| activeInHierarchy | Is the GameObject active in the scene? |
| activeSelf | The local active state of this GameObject. (Read Only) |
| isStatic | Editor only API that specifies if a game object is static. |
| layer | The layer the game object is in. A layer is in the range [0...31]. |
| scene | Scene that the GameObject is part of. |
| tag | The tag of this game object. |
| transform | The Transform attached to this GameObject. |
Constructors
| GameObject | Creates a new game object, named name. |
Public Functions
| AddComponent | Adds a component class named className to the game object. |
| BroadcastMessage | Calls the method named methodName on every MonoBehaviour in this game object or any of its children. |
| CompareTag | Is this game object tagged with tag ? |
| GetComponent | Returns the component of Type type if the game object has one attached, null if it doesn't. |
| GetComponentInChildren | Returns the component of Type type in the GameObject or any of its children using depth first search. |
| GetComponentInParent | Returns the component of Type type in the GameObject or any of its parents. |
| GetComponents | Returns all components of Type type in the GameObject. |
| GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children. |
| GetComponentsInParent | Returns all components of Type type in the GameObject or any of its parents. |
| SendMessage | Calls the method named methodName on every MonoBehaviour in this game object. |
| SendMessageUpwards | Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour. |
| SetActive | Activates/Deactivates the GameObject. |
Static Functions
| CreatePrimitive | Creates a game object with a primitive mesh renderer and appropriate collider. |
| Find | Finds a GameObject by name and returns it. |
| FindGameObjectsWithTag | Returns a list of active GameObjects tagged tag. Returns empty array if no GameObject was found. |
| FindWithTag | Returns one active GameObject tagged tag. Returns null if no GameObject was found. |
Inherited members
Variables
| hideFlags | Should the object be hidden, saved with the scene or modifiable by the user? |
| name | The name of the object. |
Public Functions
| GetInstanceID | Returns the instance id of the object. |
| ToString | Returns the name of the game object. |
Static Functions
| Destroy | Removes a gameobject, component or asset. |
| DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
| DontDestroyOnLoad | Makes the object target not be destroyed automatically when loading a new scene. |
| FindObjectOfType | Returns the first active loaded object of Type type. |
| FindObjectsOfType | Returns a list of all active loaded objects of Type type. |
| Instantiate | Clones the object original and returns the clone. |
Operators
| bool | Does the object exist? |
| operator != | Compares if two objects refer to a different object. |
| operator == | Compares two object references to see if they refer to the same object. |
Unity GameObject Class的更多相关文章
- Unity GameObject.activeSelf, GameObject.activeInHierarchy,GameObject.SetActive和SetActiveRecursively
activeSelf(read only只读):物体本身的active状态,对应于其在inspector中的checkbox是否被勾选activeInHierarchy(read only只读):物体 ...
- Unity GameObject
GameObject 游戏对象 GameObject是unity所有实体的基类 gameObject 获取当前脚本所挂载的游戏对象 一般来说,在属性视图中能看到或修改的属性,我们同样可以在脚本中获取并 ...
- Unity GameObject.FindObjectOfType<>(); 按类型查找游戏对象
FindObjectOfType<>() 是按类型查找游戏对象.<>里面填写类型,那要是有多个这种类型的呢?来试一下. 1. 新建一个场景,新建一个Test.cs脚本,内容 ...
- Unity GameObject.Find 和 transform.Find
transform.Find(""); 找到子游戏对象,找自己找不到,能找到未激活的子游戏对象. 括号里可以是游戏对象的名字,也可以是层级. GameObject.Find(&qu ...
- 从Unity引擎过度到Unreal4引擎(最终版)
原文地址:http://demo.netfoucs.com/u011707076/article/details/44036839 前言 寒假回家到现在已经有十多天了,这些天回家不是睡就是吃....哎 ...
- (转)unity使用line renderer画线
原文地址:http://www.xuanyusong.com/archives/561 任何一个无规则曲线它都是有若干个线段组成,及时是圆形它也是又若干个线段组成的,也就是说将若干个线段拼接起来就是我 ...
- Socket.IO for Unity 简要介绍
在项目中使用到了Socket.IO for unity这个Asset Store上免费的库,这里将简要的介绍一下它的结构,已经使用中的注意事项. 目录结构 上面为包的目录结构,简单的介绍一下具体的内容 ...
- unity 3D + Google Play In-app Billing (IAB)(转) 热度 3
最近由于工作需要,研究unity如何接入Google Play以实现游戏内购买.目前IAB的实现,prime31做的插件比较好,各平台的IAB均有,但费用相对过高(几乎都是70刀左右,可怜穷小子).在 ...
- Unity编程笔录--ulua+PureMVC框架简单热更新使用
ulua+PureMVC框架简单热更新使用 前言: 1:作者官网论坛 首先介绍的是这个框架是一位大牛 骏擎[CP] jarjin 写的,据说原本是"非常多人不知道怎么使用Ulua,所 ...
随机推荐
- 【Js应用实例】图片预览
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- 细说 Azure Storage 的冗余策略
当我们想要把应用搬到云端的时候,首先要关注的便是数据的安全性.当然所有的云服务厂商都会对用户数据承诺一个非常高的安全性,但万一出现意外呢?我们是不是还要有适当的应对方案?比如今年的3月8日晚间,Azu ...
- pwnable.kr brainfuck之write up
I made a simple brain-fuck language emulation program written in C. The [ ] commands are not impleme ...
- Oracle DG测试failover和后续恢复报告
Oracle DG测试failover和后续恢复报告 一.概述 二.验证过程: 2.1 A库异常关闭 2.2 B库进行failover切换为新主库 2.3 要求C库成为新主库的备库 2.4 要求A库成 ...
- LVDS/RGB转EDP稳定方案----NCS8801S
目前山寨平板市场已经进入白热化,同质化的竞争.厂商的利润被压得非常的薄.一味的价格战肯定会带来行业洗牌.差异化是许多厂商的选择,而其中一条重要的路子,就是采用高分辨率的down-grade屏.如苹果的 ...
- P问题、NP问题、NPC问题
看师兄们的论文经常说一句这是个NP难问题,所以采用另外一种方法来代替(比如凸松弛,把l0范数的问题松弛为l1范数的问题来求解).然后搜索了相关知识,也还是没看太懂,把一些理论知识先贴上来,希望以后再接 ...
- 根据本周本月本日来查询数据 C#winform数据查询
这个我是在winform的页面上做的 1. 首先是在页面上添加3个lable 第一次点击lable会有相应的数据被查询出来 第二次点击同一个lable会刷新所有的数据 2.点击不同的label会 ...
- if判断与比较操作符gt、lt、eq等的使用
在整数中比较使用如下 //-eq 等于(equal) if [ "$a" -eq "$b" ] //-ne不等于(no equal) if [ "$ ...
- 数据结构学习:KMP模式匹配算法
有关KMP的算法具体的实现网上有很多,不具体阐述.这里附上c的实现. 谈谈我自己的理解.KMP相较于朴素算法,其主要目的是为了使主串中的遍历参数i不回溯,而直接改变目标串中的遍历参数j. 比如说要是目 ...
- 从Object和Function说说JS的原型链
ECMAScript规定了两个特殊的内置对象:Object和Function.他们的特殊性在于,他们本身既是对象又是函数,而他们同时也是对象和函数的构造器.这种自己生自己的逻辑显然违反人性,如果还停留 ...