GetComponent<Move>();//獲取物件的Move組件
public class ScriptA : MonoBehaviour {
GameObject target;
void Start(){
target = GameObject.Find("ObjectB");
int _value = target.GetComponent<ScriptB>().intB;
Debug.Log(_value);
}
}
Debug.Log(_value);
}
}
Transform.GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, 0); //抓速度
Transform.GetComponent<Rigidbody2D>().AddForce(Vector2.right * 80) //加一個新的力
全站熱搜