Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Is there any way to change a collider's uniqueness at runtime?

Discussion in 'Physics for ECS' started by cj-currie, Jan 6, 2024.

  1. cj-currie

    cj-currie

    Joined:
    Nov 27, 2008
    Posts:
    337
    I have a collider I want to change the CollisionFilter of at runtime without affecting other instances of it. However, only one needs to be unique at a time and I'd like the rest of the instances to remain shared for performance reasons. Is the only way to do this to maintain two copies of the collider, one with IsUnique, and to swap them out?
     
  2. cj-currie

    cj-currie

    Joined:
    Nov 27, 2008
    Posts:
    337
  3. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    330
    You can just call the MakeUnique function on the collider you want to modify. It will get cloned and you can modify it while all the other instances still share the original collider.