Uploaded July 2021 | Updated November 2026, 3 hours ago
Unity's Editor UI does not support rendering elements in a grid. For some elements like Textures, Meshes and Materials rendering the results in a vertical list does not use the space of the LINQ for Unity editor view very effectively so a grid-based view could provide a much more concise and cleaner UI. Let's implement a way to draw these components in a Grid!
Unity's Editor UIs can expand and scale in two dimensions either vertically or horizontally. We want to create a horizontally wrapping grid, this means the grid will add elements adjacent to one another horizontally so long as extra space is available. Once no more space is available in the row we create a new row and continue adding new elements to that new row. This approach will allow the grid to expand vertically without introducing a horizontal scroll.
For our implementation we're going to be using uniformly sized grid elements. This means that every element in the grid will take up the same amount of space. Doing this prevents creating any complex layout situations (and potentially having to solve the 2D napsack problem).
***
You can find more World of Zero content at worldofzero.com or catch my streams at twitch.tv/worldofzerodev
Join the World of Zero Discord Server: discord.gg/hU5Kq2u
Unity's Editor UI does not support rendering elements in a grid. For some elements like Textures, Meshes and Materials rendering the results in a vertical list does not use the space of the LINQ for Unity editor view very effectively so a grid-based view could provide a much more concise and cleaner UI. Let's implement a way to draw these components in a Grid!
Unity's Editor UIs can expand and scale in two dimensions either vertically or horizontally. We want to create a horizontally wrapping grid, this means the grid will add elements adjacent to one another horizontally so long as extra space is available. Once no more space is available in the row we create a new row and continue adding new elements to that new row. This approach will allow the grid to expand vertically without introducing a horizontal scroll.
For our implementation we're going to be using uniformly sized grid elements. This means that every element in the grid will take up the same amount of space. Doing this prevents creating any complex layout situations (and potentially having to solve the 2D napsack problem).
***
You can find more World of Zero content at worldofzero.com or catch my streams at twitch.tv/worldofzerodev
Join the World of Zero Discord Server: discord.gg/hU5Kq2u
![Lets Make a Lazy String Parser in C#
Lets create a quick string parsing script that can read a long string and return a delimited set of results (well be finding words). We can use this to iterate through every word in the string until we find the value we are looking for without having to pre-process the entire original string.
A lazily evaluated function is one that calculates the results of the function as the values are requested. In this case it means we can create a set of integers or strings that we generate dynamically without having to first fill an array or other data structure with all the data first. This also means that for large data sets where we will stop iterating early in the list that we can process only parts of the provided data.
C#s `yield` keyword allows us to return a value from a function and then continue from that point in our code on the next iteration. This allows us to iterate through a loop and `yield` results from the inside of the loop to expose new data to the calling function before generating the complete list. Instead, our list is generated procedurally from the code in our function.
Using `yield` we can generate a lazily calculated set of values from an infinite loop.
```csharp
public static IEnumerable˂int˃ PositiveIntegers() {
for(int i = 1; i ˂ int.MaxValue; ++i) {
yield return i;
}
}
// We can print the first ten elements in the set of positive integers without
// looping through the complete set of integers.
public static void Main(string[] args) {
foreach(var number in PositiveIntegers().Take(10)) {
Console.WriteLine(number);
}
}
```
To create our lazy string parser well use the concepts above but introduce a few extra steps. Were going to step through an input string character by character to form words. When a delimiter character is found well yield the word weve found so far and then reset that word. When the next word is queried from the `IEnumerable` well repeat the process. This will keep going until we stop iterating over the `IEnumerable` result of the function or we reach the end of the function.
Our lazy string parser implementation looks like this:
```csharp
public static IEnumerable˂string˃ Parse(string content, char delimiter) {
var word = String.Empty;
foreach(var character in content) {
if (character delimiter) {
if (word != String.Empty) {
var result = word;
word = String.Empty;
yield return result;
}
} else {
word += character;
}
}
yield return word;
}
```
***
Learn more about using `yield` with more examples in this video: https://www.youtube.com/watch?v=bsZjfuTrPSA
Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u
***
The thumbnail of this video includes a modified image of [Duke Humfreys Library](https://commons.wikimedia.org/wiki/File:Duke_Humfreys_Library_Interior_3,_Bodleian_Library,_Oxford,_UK Diliff.jpg). This file is licensed under the [Creative Commons Attribution-Share Alike 3.0 Unported](https://creativecommons.org/licenses/by-sa/3.0/deed.en) license. Lets Make a Lazy String Parser in C#](https://i.ytimg.com/vi/pauxOqYU038/mqdefault.jpg)


 or my video that covers using [Unity Quaternion operators](https://worldofzero.com/videos/rotation-math-tricks-using-unitys-quaternion-operators/).
Gimble locking occurs when two or more of the axis of rotation align with one another causing the available rotations the object can take to be limited (multiple rotations cause the same overall effect on the object). You can learn more about this effect on Wikipedia: https://en.wikipedia.org/wiki/Gimbal_lock
Ive been a big fan of 6DoF games since I was really young and draw a lot of inspiration from games like Descent, Overload and more. The style of games are really fun and I highly recommend giving one a try if youve never played one before.
Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u Live Coding a Basic 6 Degree of Freedom Flight Controller](https://i.ytimg.com/vi/sCSnitP6xPo/mqdefault.jpg)




The end result of this is will allow us to tweak the radius, location, inside and outside color of the circle we draw in world space. This allows us to do a lot more than we could previously even though we havent really added that many new features. We also migrate to use an unlit shader instead of using the default PBR shader. This is new compared to our original surface shader and is closer to the end result were trying to build. An unlit shader ignores lighting in the scene including things like global illumination and allows us to get a single consistent color across the entire surface our shaders material is applied to.
The World of Zero Discord Server: https://discord.gg/hU5Kq2u Using Properties and Steps in Part 2 of our Ripple in Shader Graph](https://i.ytimg.com/vi/tL3GbBAqF3E/mqdefault.jpg)


