Asking for a collider when adding DockPosition.cs to a dock children
Hi everyone! Hoping you are all doing well wherever you are.
Describe the bug
When creating a dock from scratch, adding the DockPosition.cs to the child of the Dock.cs object is considered as an invalid operation. It is then required to add a Collider component to child object.
To reproduce
- Create an empty gameObject (the Dock)
- Add the Dock.cs component to it
- Create an empty gameObject, child of the Dock gameObject
- Add the DockPosition.cs component to it
Expected behavior
The same result as in the DockExample scene : children without any component but the DockPosition.cs
Screenshots

Your setup
- Unity 2019.4.0f1 (LTS)
- MRTK v2.4
- Legacy XR pipeline (not on the new Unity XR pipeline)
Target platform
- HoloLens 2
- UWP
Additional info
The dock from the example scene is working as intended.
@robertos I'm guessing this line was added after the example scene was made:
[RequireComponent(typeof(Collider), typeof(Rigidbody))]
greater context:
[AddComponentMenu("Scripts/MRTK/Experimental/Dock/DockPosition")]
[RequireComponent(typeof(Collider), typeof(Rigidbody))]
public class DockPosition : MonoBehaviou
I think the right thing here is just to update the example scenes to have the box collider - it's righteous I think to require people to explicitly add a collider for the dock (i.e. that's how the docking happens). I guess the tradeoff here is there's an extra step (i.e. ensuring the object has a collider) but I think that in general automagic is less good than not automagic.
This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.
This issue has been closed by an automated process because it is stale. If this is still an issue please add a new comment with more recent details and repro steps.