When using a custom script that extends TransformConstraint, the "Go to component" button in the Constraint Manager doesn't work when clicked.
To reproduce
Steps to reproduce the behavior:
Import this script
using MixedReality.Toolkit;
using MixedReality.Toolkit.SpatialManipulation;
public class CustomConstraint : TransformConstraint
{
public override TransformFlags ConstraintType => TransformFlags.Rotate;
public override void ApplyConstraint(ref MixedRealityTransform transform)
{
// not necessary for this issue
}
}
2. Open scene `HandInteractionExample`
3. Add this constraint on one of the ObjectManipulator
4. On the `Constraint Manager`, click on 'Go to component' for the custom constraint
5. See warning `Item Custom Constraint not found in window Inspector.`
## Expected behavior
The component is highlighted just as the built-in components.
## Your setup (please complete the following information)
- Unity Version 2021.3.21f1
- MRTK Version or Commit [main@d818d18](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/commit/d818d1807a2a662d60db9bb9306d2a928a54c084)
## Additional context
- When changing `$"{ObjectNames.NicifyVariableName(constraintName)}"` to `$"{ObjectNames.NicifyVariableName(constraintName)} (Script)"` in [ConstraintManagerEditor.cs](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/blob/d818d1807a2a662d60db9bb9306d2a928a54c084/org.mixedrealitytoolkit.spatialmanipulation/Editor/Constraints/ConstraintManagerEditor.cs#L113), the custom component is highlighted but break for MRTK's constraints.
- User work-around is to add `[AddComponentMenu("MRTK/Spatial Manipulation/CustomConstraint")]` attribute on the class. It changes the displayed name in inspector and removes the " (Script)" part. But it's better if this feature works out of the box for all scripts.
Describe the bug
When using a custom script that extends
TransformConstraint
, the "Go to component" button in theConstraint Manager
doesn't work when clicked.To reproduce
Steps to reproduce the behavior:
public class CustomConstraint : TransformConstraint { public override TransformFlags ConstraintType => TransformFlags.Rotate;
}