GameObject.Find 查找

static function Find (name : string) : GameObject

Description描述

Finds a game object by name and returns it.

If no game object with name can be found, null is returned. If name contains a '/' character it will traverse the hierarchy like a path name. This function only returns active gameobjects.

找到并返回一个名字为name的游戏物体。

如果以name为名字的游戏物体没有被找到,则返回空.如果name中包含'/'字符,这个名称将被视作一个hierarchy中的路径名.这个函数只返回活动的游戏物体。

For performance reasons it is recommended to not use this function every frame Instead cache the result in a member variable at startup or use GameObject.FindWithTag.

除非迫不得已,建议不要在每一帧中使用这个函数。可以在开始的时候用一个成员变量来缓存结果或者使用GameObject.FindWithTag函数。

注意:这里的参数name 是严格区分大小写的。

var hand : GameObject;
// This will return the game object named Hand in the scene.
//这将返回名为Hand 的游戏物体
hand = GameObject.Find("Hand"); // This will return the game object named Hand.
// Hand may not have a parent in the hierarchy view!
//这将返回名为Hand 的游戏物体,在层次视图中hand也没有父级物体
hand = GameObject.Find("/Hand"); // This will return the game object named Hand,
// which is a child of Arm -> Monster.
// Monster may not have a parent in the hierarchy view!
//这将返回Monster/Arm 的子级下名为Hand 的游戏物体,在层次视图中Monster也没有父级物体
hand = GameObject.Find("/Monster/Arm/Hand"); // This will return the game object named Hand,
// which is a child of Arm -> Monster.
// Monster may have a parent.
//这将返回Monster/Arm 的子级下名为Hand 的游戏物体,在层次视图中Monster可以有父级物体
hand = GameObject.Find("Monster/Arm/Hand");

unity3d GameObject.Find 严格区分大小写的的更多相关文章

  1. Unity3d gameObject

    using UnityEngine; using System.Collections; public class test : MonoBehaviour { //print只能在MonoBehav ...

  2. unity3d基础01

    Unity3d 五大视图: 1 Scene:存放hierarchy中创建的游戏对象,但实际只能看到一部分 *Scene浏览: ①右键进入“飞行模式”,方便查看整个场景 ②选中摄像机,按ALT进入浏览的 ...

  3. unity3d android互调

    unityPlayer = new AndroidJavaClass("com.xxx.xxx.MainActivity"); curActivity = unityPlayer. ...

  4. Unity进阶----AssetBundle_01(2018/10/30)

    AssetBundle作用和定义 1).AssetBundle是一个压缩包包含模型.贴图.预制体.声音.甚至整个场景,可以在游戏运行的时候被加载: 2).AssetBundle自身保存着互相的依赖关系 ...

  5. Unity组件

    在学习C++的时候,对于面对对象有点了解.然后也使用过一段时间的Unity,用起来还是觉得,怎么这么好用.耦合性极低.当时不知道这是基于组件编程.所以现在来学习下基于组件的知识,并比较下基于组件和基于 ...

  6. Unity进阶之ET网络游戏开发框架 03-Hotfix层启动

    版权申明: 本文原创首发于以下网站: 博客园『优梦创客』的空间:https://www.cnblogs.com/raymondking123 优梦创客的官方博客:https://91make.top ...

  7. ET框架之SceneChangeComponent

    初始化事件 using ETModel; namespace ETHotfix { [Event(EventIdType.InitSceneStart)] public class InitScene ...

  8. 【Unity3D基础教程】给初学者看的Unity教程(一):GameObject,Compoent,Time,Input,Physics

    作者:王选易,出处:http://www.cnblogs.com/neverdie/  欢迎转载,也请保留这段声明.如果你喜欢这篇文章,请点推荐.谢谢! Unity3D重要模块的类图 最近刚刚完成了一 ...

  9. 【Unity3D技巧】在Unity中使用事件/委托机制(event/delegate)进行GameObject之间的通信 (二) : 引入中间层NotificationCenter

    作者:王选易,出处:http://www.cnblogs.com/neverdie/ 欢迎转载,也请保留这段声明.如果你喜欢这篇文章,请点[推荐].谢谢! 一对多的观察者模式机制有什么缺点? 想要查看 ...

随机推荐

  1. hdu 2066 一个人的旅行 Dijkstra

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2066 题意分析:以草儿家为原点,给出城市间相互抵达的时间,给出草儿想去的城市,求最短时间.典型的单源最 ...

  2. 【风马一族_Java】在某个范围内,找出具有水仙花特征的数字

    打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身.例如: 153是一个"水仙花数",因为153=1的三 ...

  3. 可以支持jQuery1.10.1 的 fancybox 1.3.4, 並現在type為Ajax時,也可以定義窗口的大小。

    官網上的 fancybox 1.3.4 太老了,不支持jQuery1.10.1,改動了一下源碼,現在可以支持了. type為Ajax時,也可以定義窗口的大小. $("#ajaxlink&qu ...

  4. php学习日志(4)-The mbstring extension is missing. Please check your PHP configuration错误及解决方法

    在安装好wampServer后,一直没有使用phpMyAdmin,今天用了一下,phpMyAdmin显示错误:The mbstring extension is missing. Please che ...

  5. 系统中使用frameset和Iframe刷新页面session失效

    问题:Asp.net中每次刷新页面,session中保存的只就丢失 原因: 1.有些杀毒软件会去扫描web.config文件 2.程序内部有让session丢失的代码,或服务器内存不足 3.程序有框架 ...

  6. require.js入门指南(二)

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  7. WPF学习06:转换控件内容为可存储图片

    在图形软件中,我们经常使用到"另存为图片"的功能,本文即介绍如何将WPF控件显示内容转换为图片. , , PixelFormats.Pbgra32); bitmapRender.R ...

  8. Tmall Programmer Triples Smartisan Sales

    页面程序造假,丢脸丢到华尔街日报去咯 http://blogs.wsj.com/chinarealtime/2014/10/13/tmall-programmer-triples-smartisan- ...

  9. Gartner2014年魔力象限(商业智能和分析平台)

  10. 从零开始学ios开发(二十):Application Settings and User Defaults(下)

    在上一篇的学习中,我们知道了如何为一个App添加它的Settings设置项,在Settings设置项中我们可以添加哪些类型的控件,这些控件都是通过一个plist来进行管理的,我们只需对plist进行修 ...