- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
unity3D教程之访问其他组件
Components are attached to game objects. Attaching a Renderer component to a game object is what makes it render on the screen, attaching a Camera turns it into a camera object. All scripts are components thus they can be attached to game objects. 【狗刨学习网】组件附属于游戏物体.把一个 Renderer (渲染器)组件附到游戏对象,可以使游戏对象显示到场景,附一个 Camera (摄像机)可以把物体变成一个摄像机物体.所有脚本都是组件,因此都能附到游戏对象上.The most common components are accessible as simple member variables: 常用的组件可以通过简单的成员变量取得:ComponentAccessible asTransform transformRigidbody rigidbodyRenderer rendererCamera camera (only on camera objects)Light light (only on light objects)Animation animationCollider collider... etc.For the full list of predefined member variables see the documentation for the Component , Behaviour and MonoBehaviour classes. If the game object does not have a component of the type you wish to fetch, the above variables will be set to null. 要看所有的预定义成员变量,请查看文档 Component , Behaviour 和 MonoBehaviour 类.如果游戏对象中没有你想要取得的组件类型,上面的变量值将为null.Any component or script attached to a game object can be accessed through GetComponent.附在游戏对象上的组件或脚本可以通过GetComponent获取.C# JavaScript using UnityEngine;using System.Collections;public class example : MonoBehaviour {void Awake() {transform.Translate(0, 1, 0);GetComponentTransform().Translate(0, 1, 0);}}transform.Translate(0, 1, 0);// is equivalent to //相当于GetComponent(Transform).Translate(0, 1, 0);Note the case difference between transform and Transform . The former is a variable (lower case), the latter is a class or script name (upper case). This case difference lets you to differentiate variables from classscript names. 注意transform 和 Transform 的差异.前面是一个变量(小写),后面是一个类或脚本名称(大写).这个不同之处可以让你区分变量,类和脚本名称.Applying what we have learned, we can now find any script or builtin component which is attached to the same game object using GetComponent . Please note that to make the following example work you need to have a script called OtherScript containing a
您可能关注的文档
- 01 Linux常用命令练习__免费下载.doc
- VC++以及VS个版本比较 及 C++编译器比较.doc
- 解决proteus的c编译器问题的方法.docx
- Linux命令之sftp.doc
- matlab c++编译器的设置.doc
- WAS命令:JSPBatchCompiler+命令.docx
- 将matlab程序编译成exe文件并打包的最简单方法.doc
- (一)和谐劳动关系构建与劳动合同法解读.doc
- ( 1)时事政治试题与答案.doc
- (四川专用)2014高考语文一轮 课时专练(一) 识记现代汉语普通话常用字字音.doc
- 2010届高考数学复习强化双基系列__《立体几何—立体几何综合与应用》.ppt
- 2010届高考语文核按钮专题1:识记现代汉语普通话常用字字音.doc
- 2010年1月-2011年4月时事政治试题与答案.doc
- 2010届高考语文复习《语句》专题系列08《病句典型题专题训练》.ppt
- 2010年《初级经济基础》诉讼与仲裁法律知识练习题与答案.doc
- 2010山东高考语文试题与答案.doc
- 2009年经济师考试中级建筑经济试题与答案解析.doc
- 2010复习优质:正确使用词语(熟语).ppt
- 2010年1-12月实事政治试题与答案1.doc
- 2010年《广播电视业务》模拟试题与答案解析(二).ppt
文档评论(0)