Title: `MenuController` base class for the UI Toolkit · Issue #69 · UnityCommunity/UnityLibrary · GitHub
Open Graph Title: `MenuController` base class for the UI Toolkit · Issue #69 · UnityCommunity/UnityLibrary
X Title: `MenuController` base class for the UI Toolkit · Issue #69 · UnityCommunity/UnityLibrary
Description: Hello, I want to propose adding a system that I have implemented in previous projects of mine that use the Unity UI Toolkit. It consists of a base class MenuController which is linked to a UXLM document or a Visual Element (the view). Wh...
Open Graph Description: Hello, I want to propose adding a system that I have implemented in previous projects of mine that use the Unity UI Toolkit. It consists of a base class MenuController which is linked to a UXLM doc...
X Description: Hello, I want to propose adding a system that I have implemented in previous projects of mine that use the Unity UI Toolkit. It consists of a base class MenuController which is linked to a UXLM doc...
Opengraph URL: https://github.com/UnityCommunity/UnityLibrary/issues/69
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`MenuController` base class for the UI Toolkit","articleBody":"Hello, I want to propose adding a system that I have implemented in previous projects of mine that use the Unity UI Toolkit.\n\nIt consists of a base class `MenuController` which is linked to a UXLM document or a Visual Element (the view). When inheriting from it, allows you to add a new attribute I've defined called `QueryFromView` applicable to fields of type `VisualElement` (or subclasses) so that field is automatically initialized to an specific element from the view.\n\n\n\nYou can query by name, type, or both.\n\nIt counts with explanatory error and warning logs for every possible misuse of the system.\n\n- - - \n\nDepending on the project, I use two different variants:\n\n### Variant 1: `EditorWindow` and controller are independent\n\nWhen using this option, whenever you inherit from `MenuController` you have to inherit the base constructor in your class, like this:\n\n\n\nYou initialize your controller this way (unless you've added extra arguments to your constructor), where `visualTreeAsset` represents your view as a UXML document:\n\n\n\n### Variant 2: `EditorWindow` *is* the controller\n\nWhen opting for using this variant, you don't have to worry about constructors or inicialization. However, you have to worry about dragging the UXML file that represents your view from your EditorWindow script to the `Menu UI` field in the inspector.\n\n\n\nNote that this variant does not allow you to use as a view a VisualElement that is not represented by a UXML file.\n\n- - - \n\nDoes it sound useful for your repository? In case you like it, which variant should I implement? Please let me know what you think about it.\n\n\u003e PS: Don't mind the namespaces and spanish comments. I used screenshots from a time I shared my system in a Spanish-speaking community.","author":{"url":"https://github.com/Pituivan","@type":"Person","name":"Pituivan"},"datePublished":"2025-05-29T20:25:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/69/UnityLibrary/issues/69"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:407d323a-1603-6b5f-032d-bbf7839a1b9e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB68:338AF6:4DD9519:658718C:696D2251 |
| html-safe-nonce | b97d9cd42c8faad14c836e8be7e04f31b2cb2be9cddcdcdb921da6cb507e4a0f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjY4OjMzOEFGNjo0REQ5NTE5OjY1ODcxOEM6Njk2RDIyNTEiLCJ2aXNpdG9yX2lkIjoiNzA1NDE0NTQ2NjU3OTg4NjY3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 105bf02509115683a68c9b193fabd40d52437c8545f013d32173644d04f88350 |
| hovercard-subject-tag | issue:3101406079 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/UnityCommunity/UnityLibrary/69/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f47d18f0c83e2141844ddd225b5958f38b55e0fa672a78d822d9e23bd2e0904/UnityCommunity/UnityLibrary/issues/69 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f47d18f0c83e2141844ddd225b5958f38b55e0fa672a78d822d9e23bd2e0904/UnityCommunity/UnityLibrary/issues/69 |
| og:image:alt | Hello, I want to propose adding a system that I have implemented in previous projects of mine that use the Unity UI Toolkit. It consists of a base class MenuController which is linked to a UXLM doc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Pituivan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0944e430045f4fb5f7bd103e0660080acfe593174063212555773ca41c144a14 |
| turbo-cache-control | no-preview |
| go-import | github.com/UnityCommunity/UnityLibrary git https://github.com/UnityCommunity/UnityLibrary.git |
| octolytics-dimension-user_id | 19302334 |
| octolytics-dimension-user_login | UnityCommunity |
| octolytics-dimension-repository_id | 58604714 |
| octolytics-dimension-repository_nwo | UnityCommunity/UnityLibrary |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 58604714 |
| octolytics-dimension-repository_network_root_nwo | UnityCommunity/UnityLibrary |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 66b6e773801d28660016072069017cfcc851f54b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width