标签:ar sp on art 代码 bs as app 对象
例如:你想调用已经实例了的Player对象里的PlayJumpTo 代码里的Jump()函数
private PlayJumpTo playJumpto;
private GameObject playerObj;
void Start()
{
playerObj = GameObject.FindWithTag ("Player");
playJumpto = playerObj.GetComponent<PlayJumpTo>();
}
void Fun()
{
playJumpto.Jump();
}
那么这样就可以了,注意要将Player对象tag自己新建指定为Player,而Jump()函数也要是Public。
标签:ar sp on art 代码 bs as app 对象
原文地址:http://www.cnblogs.com/Kprogram/p/4047182.html