unity中三种调用其他脚本函数的方法

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

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

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

posted @ 2016-06-08 23:43  VinGe  阅读(26155)  评论(0编辑  收藏  举报