Transform.Find();,FindObjectOfType<>();,GetComponent<>()
2017-08-19 17:16
691 查看
transform.Find();
通过名字查找子物体,原来一直以为只能查找挂载该脚本的物体下的子物体,后来经过测试发现,也能找到同级别的物体下的子物体
方法是:transform.Find("同级别的物体的名字/ 子物体名");
FindObjectOfType<>();
找到挂<脚本>载该脚本的第一个物体
GetComponent<>();
直接获取该物体下的<组件名>某组件。
通过名字查找子物体,原来一直以为只能查找挂载该脚本的物体下的子物体,后来经过测试发现,也能找到同级别的物体下的子物体
方法是:transform.Find("同级别的物体的名字/ 子物体名");
FindObjectOfType<>();
找到挂<脚本>载该脚本的第一个物体
GetComponent<>();
直接获取该物体下的<组件名>某组件。
相关文章推荐
- Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#<Object>‘的解决方法
- 关于 "Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function" 的解决方案
- transform.rotation和GetComponent<Rigidbody>().MoveRotation
- Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
- 在Unity内制作工具(1)--MenuItem,Resouces.FindObjectsofTypeAll<>与EditorWindow自制编辑器窗口
- type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds int,java.lang.Object
- Initializing 'Object' *__strong' with an expression of incompatible type 'id <Object> _Nullable
- Resources.FindObjectsOfTypeAll<T>()的坑(Ghost prefab)
- 深层次理解JNI中的GetArray<PrimitiveType>Elements()函数
- <form action="get.php" method="post" id="tform"> <input type="text" name="one"> <a href="jav
- Flex进行数据类型判断:is typeof ObjectUtil.getClassInfo
- get_device和put_device ,以及of_node_get <->of_node_put
- The entity type <type> is not part of the model for the current context
- unity3d 关于FindObjectsOfType和FindObjectOfType 之遍历对象
- Could not find MessageBodyWriter for response object of type: application/json
- Error Log: type parameters of <T>T cannot be determined; no unique maximal instance exists for ...
- 窗体Controls的OfType<>方法的使用
- static function FindObjectsOfType (type : Type) : Object[]
- 自动赋值方法CloneObjectData<SourceType, CloneType>-atnet类库
- No service of type Factory<LoggingManagerInternal> available in ProjectScopeServices.