Search Unity

  1. The 2021.2 beta is now available. To find out what's new, have a look at our 2021.2 beta blog post.
    Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. Dismiss Notice

Unity Tiny - 2D physics Issue

Discussion in 'Project Tiny' started by Rangerz132, May 20, 2021.

  1. Rangerz132

    Rangerz132

    Joined:
    Feb 3, 2019
    Posts:
    20
    Hi Eveybody!

    I have some issues with the the 2D physics using Unity Tiny.

    Some of my entities have a Box Collider 2D component, I would like to remove them dynamicly via scripts. In order to do it, I simply do:

    Code (CSharp):
    1. Entities.ForEach((ref Entity entity, ref Column column) =>
    2. {
    3.    EntityManager.RemoveComponent<PhysicsColliderBlob>(entity);
    4. }).WithStructuralChanges().Run();
    However, when I want to re-add a box Collider 2D to them, I don't know how to do it. If I copy the exact same code but with AddComponent<> instead of RemoveComponent<>, it does'nt work.

    Can somebody help me? Thanks
     
unityunity