Note: if you use 2d/3d Box or Capsule Colliders, please, do not attach your own 2d/3d box colliders to child GameObjects right under the spline,
cause they may be reused and deleted.
How to change spline with colliders at runtime
Animate spline with script or Unity animation (more info)
Set "Math Type" parameter of Math component to "Base". Adjust "Section Parts" parameter value to be as
little as possible
For 2d/3d box components, toggle on "Generate kinematic rigidbodies" parameter. For 2d edge, add
RigidBody2D component and toggle "isKinematic" on
Turn on snapping (Under Points tab) if you need it. Setup "Snap Layer Mask" for collisions.
Add "Collider 3D Box" component (under Components tab). This component reuses 1 level children
GameObjects with BoxCollider attached,
so do not place any additional BoxColliders under spline's GameObject.
Adjust Resolution. You can adjust the number of points you want to split the spline to by adjusting
Math's components properties (if you set SplitMode to 'UseMathData'),
or you can change SplitMode to PartsTotal or PartsPerSection and assign the number os splits directly.
We recommend to set SplitMode to 'UseMathData' (default) and change MathType of Math component to
Adaptive and adjust Tolerance.
Adjust "Collider 3D Box" component properties if needed (like Width, Heigth, OffSet etc.)
Turn on snapping (Under Points tab) if you need it. Setup "Snap Layer Mask" for collisions.
Add "Collider Capsule" component (under Components tab). This component reuses 1 level children
GameObjects with CapsuleCollider attached,
so do not place any additional CapsuleColliders under spline's GameObject.
Adjust Resolution. You can adjust the number of points you want to split the spline to by adjusting
Math's components properties (if you set SplitMode to 'UseMathData'),
or you can change SplitMode to PartsTotal or PartsPerSection and assign the number os splits directly.
We recommend to set SplitMode to 'UseMathData' (default) and change MathType of Math component to
Adaptive and adjust Tolerance.
Adjust "Collider Capsule" component properties if needed (like Radius and LengthExtends etc.)
Add "Collider 2D Box" component (under Components tab). This component reuses 1 level children
GameObjects with BoxCollider2D attached,
so do not place any additional BoxCollider2D under spline's GameObject.
Adjust Resolution. You can adjust the number of points you want to split the spline to by adjusting
Math's components properties (if you set SplitMode to 'UseMathData'),
or you can change SplitMode to PartsTotal or PartsPerSection and assign the number os splits directly.
We recommend to set SplitMode to 'UseMathData' (default) and change MathType of Math component to
Adaptive and adjust Tolerance.