Search Unity

Unity 2020+ SetParent OnCollisionEnter Problem?

Discussion in 'Scripting' started by Bongmo, Apr 22, 2021.

  1. Bongmo

    Bongmo

    Joined:
    Jan 18, 2014
    Posts:
    155
    Hi.

    I've downloaded the latest recommended Unity version 2020.3.4. Now my project does not work anymore.

    This following example worked with Unity 2018 and 2019 without any problems.



    I have a sphere on a cube. I set the cube with set parent to another object. Then I set the cube set parent to null. This causes many OnCollisionEnter() calls. With Unity 2018 and 2019 I got only one OnCollisionEnter().

    How can I only get a one OnCollisionEnter() call?

    Any ideas?

    I attached the simple project, if you want to look at it.
     

    Attached Files: