I am making a 2D game and I want a 2D rigid body to get a speed boost when entering a 2D trigger, but I cannot get it to work. The object is not getting a speed boost. I am new to coding and am coding in C#. Here is the script I have.
You need to access Rigidbody2D of Collider2D other that is entering the trigger. Keyword new is required for constructors. void OnTriggerEnter2d (Collider2D other) { other.GetComponent<Rigidbody2D> ().AddForce (new Vector2(10f, 0f)); }