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 Change PhysicsCollider at runtime

Discussion in 'DOTS Dev Blitz Day 2022 - Q&A' started by optimise, Dec 8, 2022.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,137
    At dots netocode, I believe when u try to change PhysicsCollider data at runtime like changing size it will not sync data to both client and server since it's using blob asset. Does it means I need to create custom component to handle this? Or is there any plan to make blob asset possible to sync data to both client and server in future?
     
    goncalo-vasconcelos likes this.
  2. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    129
    I'd recommend doing something like this:
    • Create a "ColliderSize" Component, with a "float Size" ghost field
    • Have a system that runs on both client and server, which sets the size of the collider based on that "Size" value
    In other words; control the size of the collider based on some ghost field in a ghost component, and avoid changing the size every frame by only changing it if it's different from the current size (you may want to store the last applied size in a non-ghosted field for quicker comparison)