itch.io is community of indie game creators and players

Devlogs

HeavenX Devlog 0009

HeavenX
A downloadable game

My current project within HeavenX isn't all that exciting. I can't speak to the creative side of building UI, but on the implementation side it's a lot of tedious positioning and writing code to glue things together. So, this devlog is going to be more of a ramble about issues I've had with Unity and game development in general.

Unity's Rough Edges

For an engine that's been around for 20 years, Unity has some strange, rough edges. Don't get me wrong, with few exceptions you'll find issues with any piece of software if you use it long enough, let alone one as big and complex as a game engine. However, some of the issues are just... out there in the open. Take for instance the RectTransform, the component that controls the size and position of UI elements. It provides a lot of functionality. However, that seemingly comes at the cost of being incoherent. I cannot stress enough that there is no straightforward way to ask what the width or height of a UI element is. Most people would point to the sizeDelta

, but, as the name implies, it's not exactly the dimensions. Sometimes it is. Sometimes it isn't. It's a relative unit and depends on the setup.

Apparently the title bar's width is -8 Some might point to the Rect

, but that's not right either. It doesn't include scaling. This also extends to GetLocalCorners

which doesn't include any scaling or rotation. For most cases, that means the solution is tf.rect.size * tf.localScale

. Sure, that's ultimately a simple fix; not a big deal. But that is the problem. It's something basic that's causing friction, and Unity has far too many cases like this.

Difficult vs Impossible

Another rough edge is that support for gradients in shaders is in a weird place. In the shader graph you can create and use a gradient parameter, but there's no way to change it.

It's hard to see, but this box to expose the variable is greyed out. I found a Unity developer response to questions about this that was, by my uncharitable reading, "that would be too hard to implement so we're not doing it." Perhaps it's my own personal bubble, but I feel like I've seen a lot of that sort of defeatism recently. At best it's an excuse to quit, and at worst the word "difficult" is thrown out as a softer alternative to "impossible." I understand that often other people have done the hard work, and that some things simply take too long to really be worth the effort; I've certainly spent more time coding something from scratch that could have been a third party library than I would care to admit. But, taken to the extreme, that's stagnation. Is your project improving if you aren't tackling the hard problems? Are you growing if you're avoiding the hard problems? TL;DR don't instantly give up at things being difficult, and I'm mad at Unity for not letting me fully use gradients.

Sorry for waxing philosophical at the end there, but the alternative was talking about fighting TextMeshPro to get correct pixel alignment with fonts. 

- Jake, Programming Lead

Leave a comment