About 145,000 results
Open links in new tab
  1. Unity - Scripting API: MonoBehaviour.OnTriggerEnter2D (Collider2D)

    Sent when another object enters a trigger collider attached to this object (2D physics only). Further information about the other collider is reported in the Collider2D parameter passed …

  2. Why isn't my OnTriggerEnter2D () function working? - Unity

    Dec 8, 2013 · You don’t need to make gravity scale 0. Put a rigidbody2d on both of the objects and then you will be able to make them both kinematic with the collision or trigger working.

  3. c# - How can i use OntriggerEnter2D on unity? - Stack Overflow

    Jul 28, 2023 · Collider2D won't work without one. If you don't want the hole to be affected by physics, set the body type to kinematic. Also, check if you've set the hole's collider to be a …

  4. 2d - How do I trigger just once and not multiple times if I the …

    Apr 28, 2016 · According to the Unity documentation for OnTriggerEnter2D the trigger is " [s]ent when another object enters a trigger collider attached to this object (2D physics only)". The …

  5. Learn OnCollisionEnter and OnTriggerEnter | Unity Physics

    Trigger: Unlike OnCollisionEnter2D, this method is not about physical collisions, but rather about detecting when one object enters the space of another without necessarily stopping their motion.

  6. Unity - Scripting API: Collider.OnTriggerEnter (Collider)

    Called when a Collider with the Collider.isTrigger property overlaps another Collider. OnTriggerEnter is invoked when two GameObjects with a Collider component touch or …

  7. c# - Unity OnTriggerEnter2D not registering - Stack Overflow

    Aug 20, 2020 · In 2D physics, I believe the z coordinate is ignored, so I don't think this is the issue. Also in this case, just for testing, I personally wouldn't write a script to move the object. I …

  8. OnTriggerEnter2D with if/else - Unity Engine - Unity Discussions

    Sep 14, 2022 · Use OnTriggerEnter2D for when you enter a trigger and OnTriggerExit2D for when you exit a trigger. If you don’t know this then I would highly suggest following a basic 2D …

  9. unity - OnTriggerEnter2D and OnTriggerExit2D are firing each …

    OnTriggerEnter2D stops the ball, OnCollisionStay2D adds to an acceleration variable while the ball is still colliding, and OnTriggerExit2D flips the direction of the ball and applies the …

  10. Unity 2D Collision detection(OnCollisionEnter2D and …

    Learn Unity 2D Collision detection with OnCollisionEnter2D and OnTriggerEnter2D. This tutorial is completely focused on Collision for 2D games.