API_Object_GameObject类
2020-06-25 04:26
204 查看
using UnityEngine; /* * API_Object_GameObject * 2020/6/4 */ public class API_Object_GameObject : MonoBehaviour { public GameObject go; // Start is called before the first frame update void Start() { print("返回对象的名称:" + go.ToString()); //销毁对象 GameObject.Destroy(go,3.0f); //在新场景中保留对象 GameObject.DontDestroyOnLoad(go.GetComponent<Rigidbody>()); //用于获取工程中所有符合参数类型的对象,多用于检测工程中是否含有type类型的对象 GameObject.FindObjectsOfType(typeof(Light)); //返回含有Light类型组件的对象数组 //实例化(克隆)对象 GameObject.Instantiate(go,Vector3.zero,Quaternion.identity); //获取组件,返回Type类型的组件,若没有返回null go.GetComponent<Transform>(); //增加组件 go.AddComponent<Rigidbody>(); //向自己发送消息 gameObject的名字是该脚本:API_Object_GameObject gameObject.SendMessage("Attack", gameObject.name + "接收到了发送的消息"); //向自己和子类广播消息 不一定需要接收者,没有也不报错 go.BroadcastMessage("Attack", "接收到了"+go.name +"广播的消息",SendMessageOptions.DontRequireReceiver); //向自己和父类发送消息 gameObject.SendMessageUpwards("Attack", "接收到了" + this.gameObject + "发送的消息"); //根据给定的true或false值激活/停用GameObject go.SetActive(false); } }
相关文章推荐
- ZT - Simple JavaScript Object Reflection API (.NET Style)
- ES6 Object的新增 API
- TensorFlow Object Detection API 在Windows10和Ubuntu上的配置
- Export DWG with ObjectData to ESRI shape file using AutoCAD Map 3D API
- 4000 装tensorflow object detection API遇到的问题
- TensorFlow Object Detection API 跑代码过程
- TensorFlow Object Detection API教程——制作自己的数据集
- win10中anaconda环境调用tensorflow的object_detection api,环境配置问题及其解决
- Java基础 - Eclipse,API,Object常用方法
- Ubuntu object_detection API 目标检测环境搭建
- mac OS 安装tensorflow并配置TensorFlow Object_detection API
- Java常用API(四)——所有类的超类Object中常用方法的重写
- 谷歌开放的TensorFlow Object Detection API 效果如何?对业界有什么影响
- 基于谷歌开源的Object-Detection API实现视频目标检测(tensorflow+opencv+anaconda3)
- 微信小程序跳转API的理解 wx.redirectTo(Object object) wx.navigateTo(Object object)
- Training for Tensorflow object detection API
- 对于谷歌开源的TensorFlow Object Detection API视频物体识别系统实现教程
- 黑马程序员——常用API——Object,Scanner,String
- TensorFlow object detection api------ssd_mobilenet使用
- Java-API学习笔记---Object