unity3D笔记の四种调用其他脚本方法

第一种,被调用脚本函数为static类型,调用时直接用  脚本名.函数名()

第二种,GameObject.Find("脚本所在的物体的名字").SendMessage("函数名");                                                  //能调用public和private类型函数

第三种,GameObject.Find("Main Camera").GetComponent<sheji>().SendMessage("SetWipeOutNum",null);  //可以添加参数

第四种,GameObject.Find("脚本所在的物体的名字").GetComponent<脚本名>().函数名();                                 //只能调用public类型函数

原文地址:https://www.cnblogs.com/xietianjiao/p/10893805.html