Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRTK3 Theming for Canvas Objects #189

Open
IssueSyncBot opened this issue Aug 20, 2023 · 3 comments
Open

MRTK3 Theming for Canvas Objects #189

IssueSyncBot opened this issue Aug 20, 2023 · 3 comments
Labels
Type: Feature Request A request for a new feature that can be included with the next minor version release.

Comments

@IssueSyncBot
Copy link

IssueSyncBot commented Aug 20, 2023

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)

  • Unity Version 2021.3.15f1
  • MRTK Version [e.g. v2.0]

Target platform (please complete the following information)

  • HoloLens 2

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: microsoft/MixedRealityToolkit-Unity#11406

@IssueSyncBot IssueSyncBot added MRTK3 Type: Feature Request A request for a new feature that can be included with the next minor version release. labels Aug 20, 2023
@IssueSyncBot
Copy link
Author

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: microsoft/MixedRealityToolkit-Unity#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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Request A request for a new feature that can be included with the next minor version release.
Projects
None yet
Development

No branches or pull requests

2 participants