MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Asking for a collider when adding DockPosition.cs to a dock children

Open nooxouille opened this issue 6 years ago • 3 comments

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

  1. Create an empty gameObject (the Dock)
  2. Add the Dock.cs component to it
  3. Create an empty gameObject, child of the Dock gameObject
  4. 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

Unity_0YWZA1USvl dPDcRRnnjI

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.

nooxouille avatar Jun 16 '20 07:06 nooxouille

@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.

wiwei avatar Jun 16 '20 18:06 wiwei

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.

stale[bot] avatar Dec 25 '20 12:12 stale[bot]

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.

stale[bot] avatar Apr 18 '22 23:04 stale[bot]