MixedRealityToolkit / MixedRealityToolkit-Unity

This repository holds the third generation of the Mixed Reality Toolkit for Unity. The latest version of the MRTK can be found here.
BSD 3-Clause "New" or "Revised" License
374 stars 96 forks source link

MRTK3 Theming for Canvas Objects #189

Open IssueSyncBot opened 1 year ago

IssueSyncBot commented 1 year ago

Original issue opened by:

@HaiKonofanDesu @HaiKonofanDesu


Describe the bug

Hey guys, not sure if someone can help me but I currently play around with the experimantal Themeing Option in MRTK3. Thanks to the Databind Example I got Non Canvas UI to work but not matter what I do I can't get Canvas Elements to change color. I used the 3 Themes from Zappys Playground but I can't use the scripts there as they all depend on so many other scripts and stuff that I don't want to redo all the scripts.

I have the Theme Selector and Theme Provider on an Empty Object that does not get destroyed on Scene change and I have Consumer Helper on my Canvas Object in the current scene. Anyone has an Idea/ and example where it works? I appreciate all the help I can get.

To reproduce

I have the Theme Selector and Theme Provider on an Empty Object that does not get destroyed on Scene change and I have Consumer Helper on my Canvas Object in the current scene.

Expected behavior

Canvas Object changes color

Screenshots

image image image

(the small non canvas Button changes color, just not my big Login Canvas)

Your setup (please complete the following information)

Target platform (please complete the following information)

Additional context

Could only find Non Canvas Examples in this Repo. The only color changing canvas example I found is Zappys Playground. Saldy since I did not use Zappys Playground as the base for my project I can't use the scripts 1:1 thanks to all the other stuff that happens there. Might ReDo my Project in the Future with Zappy as the base for translations and stuff but for now I can't


ISSUE MIGRATION

Issue migrated from: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/11406

IssueSyncBot commented 1 year ago

Original comment by:

@Zee2 Zee2


Hey there, I wanted to give a quick heads up to save you some time hunting.

We were in the process of publishing the revised theming system that is compatible with our canvas UI tooling when the entire MRTK team was eliminated. The existing theming system does not work with Canvas UI.

When the team was eliminated, I created a pull request with our work in progress updated theming infrastructure. You can see it here: https://github.com/microsoft/MixedRealityToolkit-Unity/pull/11387

Feel free to copy, reuse, repurpose or repurpose that for however you see fit. Unfortunately due to my current job I am not at liberty to contribute.

Sorry I don't have better news.

IssueSyncBot commented 1 year ago

Original comment by:

@HaiKonofanDesu HaiKonofanDesu


Hey @Zee2 thanks for the anwers. Still mad at Microsoft that they killed this project literally a month before GA. Still thanks for the detailed answer, guess I will use some time in the future to dig into it.

Good luck at your new? job tho!

IssueSyncBot commented 1 year ago

Original comment by:

@HaiKonofanDesu HaiKonofanDesu


Got the Themes of Zappys Playground working in my project. Here are all the Steps I did: Copy this Folder in my Project: https://github.com/microsoft/ZappysPlayground/tree/8693f527a6a30fd8db0c4c7c7bbce98459331c2f/Assets/MSPlayground/Core/Data

Import com.unity.localization through the package manager

Attach the Theme Selector, Data Source Provider and Data Source Theme Provider to an empty Object (my Setting Object) Attach the "Data Consumer Maskable Graphic Material" Script to your Themeable Object. Set "Maskable Graphics To Modify" to the Backplate Canvas Element(s) in your Themeable Object Set "Data Binding Profile" a new Profile with the "Data Key Path" to "MatsCanvas.InnerPlateMaterial"

With that my object got the proper Material. Right now I need to manually do these last steps for all UI Elements but hey as long as it works I'm happy. I'm still open to improvements/ other strategies to make it work.

Big thanks to Edd Smith from the Slack Community for the idea of using the Zappys Playground Data Folder