Sharing the noscripts and code I use to create component based UI with the UI Toolkit in a code first/programmatic approach
Sharing it incase someone else who also prefers to do stuff through code might find it useful. And since I've seen a lot of people mention they dislike working with the UI Toolkit (and personally I find it easy to work with, so maybe someone else might also find it useful)
The noscripts and code: https://github.com/TonWonton/UnityUIToolkit_ComponentBasedCodeFirst
They are licensed with the MIT-0 No Attribution license, which means you can do basically anything with/to it. Don't even have to give credit/attribution or include the license file if you use it in anything.
TLDR of what the noscripts do and how it works is
- On the gameobject theres one "top level" UI noscript that you add whatever UI controllers you want on it
- The UI controllers are then initialized which causes them to create the elements related to them
- The "top level" UI noscript then handles the logic for the overall state and the UI controllers handle the functionality and logic for themselves and it's elements (it can be coded to do whatever you want ofc. but thats atleast what I use it for)
So basically composition where most parts should be modular and reusable (depending on how you use/code it), such as the elements themselves, UI controllers, and also the gameobject and "top level" UI if you make it into a prefab.
Its also almost fully automated. It will automatically create the elements and then remove the elements when the gameobject is destroyed or disabled, as well as register or unregister C# events at the same time by just filling out a few methods with a few lines of code.
With this workflow basically all of the work can be done with the IDE or text editors. I only have to use the UnityEditor to create a gameobject that holds the UIDocument and attach the noscripts I want to use on it.
Its a code first approach so you have to write code for the stuff you create such as writing custom elements and the logic/functionality for them (also all the noscripts are abstract classes so theres nothing you can use out of the box without coding sorry lol). I've written a lot about it and how I use it in the README on the github page, as well as included a lot of examples and other noscripts I find useful. There might ofc. be better approaches to doing UI (tbh I'm not the most experienced in coding and Unity so not sure) but I hope atleast someone might find it useful. If you have any questions or would like to see more or specific examples feel free to ask.
https://redd.it/1pwtdec
@r_Unity3D
Sharing it incase someone else who also prefers to do stuff through code might find it useful. And since I've seen a lot of people mention they dislike working with the UI Toolkit (and personally I find it easy to work with, so maybe someone else might also find it useful)
The noscripts and code: https://github.com/TonWonton/UnityUIToolkit_ComponentBasedCodeFirst
They are licensed with the MIT-0 No Attribution license, which means you can do basically anything with/to it. Don't even have to give credit/attribution or include the license file if you use it in anything.
TLDR of what the noscripts do and how it works is
- On the gameobject theres one "top level" UI noscript that you add whatever UI controllers you want on it
- The UI controllers are then initialized which causes them to create the elements related to them
- The "top level" UI noscript then handles the logic for the overall state and the UI controllers handle the functionality and logic for themselves and it's elements (it can be coded to do whatever you want ofc. but thats atleast what I use it for)
So basically composition where most parts should be modular and reusable (depending on how you use/code it), such as the elements themselves, UI controllers, and also the gameobject and "top level" UI if you make it into a prefab.
Its also almost fully automated. It will automatically create the elements and then remove the elements when the gameobject is destroyed or disabled, as well as register or unregister C# events at the same time by just filling out a few methods with a few lines of code.
With this workflow basically all of the work can be done with the IDE or text editors. I only have to use the UnityEditor to create a gameobject that holds the UIDocument and attach the noscripts I want to use on it.
Its a code first approach so you have to write code for the stuff you create such as writing custom elements and the logic/functionality for them (also all the noscripts are abstract classes so theres nothing you can use out of the box without coding sorry lol). I've written a lot about it and how I use it in the README on the github page, as well as included a lot of examples and other noscripts I find useful. There might ofc. be better approaches to doing UI (tbh I'm not the most experienced in coding and Unity so not sure) but I hope atleast someone might find it useful. If you have any questions or would like to see more or specific examples feel free to ask.
https://redd.it/1pwtdec
@r_Unity3D
GitHub
GitHub - TonWonton/UnityUIToolkit_ComponentBasedCodeFirst
Contribute to TonWonton/UnityUIToolkit_ComponentBasedCodeFirst development by creating an account on GitHub.
How do you make a city feel “alive and flashy” with as few steps as possible in Unity?
https://redd.it/1pwvtqb
@r_Unity3D
https://redd.it/1pwvtqb
@r_Unity3D
Reddit
From the Unity3D community on Reddit: How do you make a city feel “alive and flashy” with as few steps as possible in Unity?
Explore this post and more from the Unity3D community
[iOS / Android] Under Up — A 2D Physics-Based Casual Game Made in Unity
https://redd.it/1px6win
@r_Unity3D
https://redd.it/1px6win
@r_Unity3D
Designing a block puzzle game around 8 core modes. Looking for feedback.
https://www.youtube.com/watch?v=GCE39Y3AOkM
https://redd.it/1pwykml
@r_Unity3D
https://www.youtube.com/watch?v=GCE39Y3AOkM
https://redd.it/1pwykml
@r_Unity3D
YouTube
The Superset Block Puzzle Game and Its 8 Core Modes Scalable into Dozens of Variations #gamedev
I’m excited to share not just a second or third game mode, but all eight core modes of a block puzzle game I’ve been building.
After playing dozens, if not hundreds, of block puzzle games, I noticed that most of them boil down to the same small set of core…
After playing dozens, if not hundreds, of block puzzle games, I noticed that most of them boil down to the same small set of core…
Pokémon-style
So I have a game idea/name with multiple word documents with information including a skeleton/body, missions, map-layout. But i want to actually play it. Lol a brief background to give this game reasoning, I just graduated from Saint Louis University for Cannabis Science and Operations and have taken the deep dive into this industry. I do not want or intend to offend anyone, this is just a dream I have been have been having and I find its about time for it to become a reality.
Game Idea
Top-down, Pokémon-style progression game, where players become master growers by exploring distinct neighborhoods, completing missions, and cultivating unique seeds. You start from "The Block," the hub, and unlock North, South, East, and West districts, each with its own vibe and NPC contacts. By completing missions, you earn seeds, grow them in your Safehouse, and harvest flower for Street Cred. That Street Cred lets you upgrade your gear, unlock more missions, and climb toward Level 100. It’s all about the joy of planning, growing, and unlocking the top cultivars!
https://redd.it/1px00kd
@r_Unity3D
So I have a game idea/name with multiple word documents with information including a skeleton/body, missions, map-layout. But i want to actually play it. Lol a brief background to give this game reasoning, I just graduated from Saint Louis University for Cannabis Science and Operations and have taken the deep dive into this industry. I do not want or intend to offend anyone, this is just a dream I have been have been having and I find its about time for it to become a reality.
Game Idea
Top-down, Pokémon-style progression game, where players become master growers by exploring distinct neighborhoods, completing missions, and cultivating unique seeds. You start from "The Block," the hub, and unlock North, South, East, and West districts, each with its own vibe and NPC contacts. By completing missions, you earn seeds, grow them in your Safehouse, and harvest flower for Street Cred. That Street Cred lets you upgrade your gear, unlock more missions, and climb toward Level 100. It’s all about the joy of planning, growing, and unlocking the top cultivars!
https://redd.it/1px00kd
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community