GetComponentMove();//獲取物件的Move組件

public class ScriptA : MonoBehaviour {
GameObject target;
void Start(){
target = GameObject.Find("ObjectB");

int _value = target.GetComponent<ScriptB>().intB;
Debug.Log(_value);
}
}

Transform.GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, 0);  //抓速度

Transform.GetComponent<Rigidbody2D>().AddForce(Vector2.right * 80) //加一個新的力

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 gundamhina 的頭像
    gundamhina

    gundamhina的部落格

    gundamhina 發表在 痞客邦 留言(0) 人氣()