microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

BoundsControl -> Change ConfigProfiles at runtime #9208

Closed KarlSupertramp closed 9 months ago

KarlSupertramp commented 3 years ago
public class CustomBoundsControl : MonoBehaviour
{
    GameObject hoverObj;

    [SerializeField] TranslationHandlesConfiguration transConfig;
    [SerializeField] RotationHandlesConfiguration rotConfig;
    [SerializeField] ScaleHandlesConfiguration scaleConfig;

    void Start() 
    {
        hoverObj = Instantiate(new GameObject(), transform);
        var hoverBounds = hoverObj.AddComponent<BoundsControl>();
        hoverBounds.Target = gameObject;
        hoverBounds.TranslationHandlesConfig = transConfig;
        hoverBounds.RotationHandlesConfig = rotConfig;
        hoverBounds.ScaleHandlesConfig = scaleConfig;      
    }  
}

I'm trying create a child object of the an ObjectManupilator with BoundsControl as a component. I have created multiple variants of ConfigProfiles for different types of objects. It's important to update these profiles in runtime. My problem is, that i can't even initialize a GameObject and add the component correctly. It always looks like the default settings of the BoundsControl (even though the inspector shows the right profile)

I tried using boundsControl.CreateRig() to update the profile without success. It seems to me, that the BoundsControl needs to be added outside PlayMode to display the correct config profile and therefore, can't really be updated. Am I missing something?

I'd love to see a "UpdateProfiles()" method in the future, if my assumption is correct.

Unity editor version

2019.4.16f1

Mixed Reality Toolkit release version

2.5.3

FlorianJa commented 3 years ago

Probably a duplicate of #9044 which is already fixed. I dont know if the changes are already in the current release.

IssueSyncBot commented 9 months ago

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visithttps://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!