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

ButtonConfigHelper - access modifiers hinder extending the class #9016

Closed FlorianJa closed 9 months ago

FlorianJa commented 3 years ago

Hi, I am working on multi language support for my application (localization). Therefore, I want to use Unitys’ Localization package. Currently, I am thinking about a good way to implement the localization for the pressable buttons and I came across some issues. I would like to extend the ButtonConfigHelper script by deriving my own class (something like ButtonConfigHelperCustom) for having only one place to change all UI stuff but unfortunately there are many private properties which I need in the derived class as well. The ButtonConfigHelper is marked as partial but this is not useful for me because I also need to add some logic to the OnEnable and OnDisable methods. This also brings me to the next problem, the custom inspector/editor. The inspector does not find the added properties in the other file of the partial class (maybe I messed something up here). Furthermore, deriving my own inspector from this class does not work as well, because of the access modifiers.

I have now two questions:

  1. How would you add the localization to the button (or other UI elements in the MRTK) without many changes to the original UI elements? Changing language should be possible during runtime without restarting the app.

  2. This question is more related to the MRTK: Why are there so many private fields? Why not use protected when the class allows to be extended/derived (not marked as sealed). Was this a specific design choice or an accident?

Maybe @Railboy can asnwer my second question since he created the script.

Mixed Reality Toolkit release version

MRTK 2.5.1 via UPM

stale[bot] commented 2 years ago

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.

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 visit https://www.mixedrealitytoolkit.org.

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