Search Unity

Rejoining 2D Joints

Discussion in 'Entity Component System' started by JooleanLogic, Jun 18, 2020.

  1. JooleanLogic

    JooleanLogic

    Joined:
    Mar 1, 2018
    Posts:
    447
    I have two GameObjects with Rigidbody2D components in a scene.
    One has a SliderJoint2D with its connectedBody property set to the other rigid body.

    I'm using AddHybridComponent during conversion to add all the Phys2D components.

    During conversion, Unity clones the GameObjects into CompanionLink and the originals are destroyed.
    Thus the connectedBody property on the joint is no longer valid.

    The cloning doesn't seem to happen until after the conversion systems have run though.

    Is there anywhere in the conversion process I should be able to rejoin my Joint2Ds or is it something I should put in an InitializationSystemGroup to run after the ConvertToEntitySystem?