Add Pivot to Disc, Rectangle and RegularPolygon as a dedicated field

Avatar
  • updated
  • Currently out of scope

Hello Freya. I created package which integrate almost all your shapes to work with RectTransform. That is working great. But some shape doesn't have enough fields to work with. That is just a pivot. Common case in UI when RectTransform has non centered pivot. In this case there is no way to move the shape by the offset. Just nesting it as a child gameObject and moving them separated. That makes non intuitive and overcomplicated way for a user to works with Shapes and UI.

That is why I am asking you to add Pivot property to: Disc, Rectangle, Regular polygon.


There are two modes in my package FILL and FIT.

Ability to save shape AspectRatio
Works perfectly with the list of shapes
--- Disc (nested)
--- Line
--- Polygon
--- Polyline
--- Quad
--- Rectangle (nested)
--- RegularPolygon (nested)
--- Triangle

https://github.com/IvanMurzak/Unity-Extensions#shapes-recttransform

You may use my package as part of your plugin. Or takes pieces of code from it. My goal is to make work process ease as much as possible. 

Best regards

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Currently out of scope

so, part of why Shapes doesn't have native support for Unity's UI system is precisely because of issues like this, among many others

UI fundamentally has a different set of constraints, especially when used on game objects, offsetting pivots like this is a rare use case outside of that, since you can simply move the transform, and adding a pivot offset like this means more properties of the shaders are taken up by something very rarely used, effectively wasting it, and I have to manage the property economy to some extent!

your extension looks neat though! I just think it's out of scope for me to do this natively in Shapes unfortunately

Avatar
Freya Holmér creator
  • Answer
  • Currently out of scope

so, part of why Shapes doesn't have native support for Unity's UI system is precisely because of issues like this, among many others

UI fundamentally has a different set of constraints, especially when used on game objects, offsetting pivots like this is a rare use case outside of that, since you can simply move the transform, and adding a pivot offset like this means more properties of the shaders are taken up by something very rarely used, effectively wasting it, and I have to manage the property economy to some extent!

your extension looks neat though! I just think it's out of scope for me to do this natively in Shapes unfortunately

Avatar
Ivan Murzak
Quote from Freya Holmér

so, part of why Shapes doesn't have native support for Unity's UI system is precisely because of issues like this, among many others

UI fundamentally has a different set of constraints, especially when used on game objects, offsetting pivots like this is a rare use case outside of that, since you can simply move the transform, and adding a pivot offset like this means more properties of the shaders are taken up by something very rarely used, effectively wasting it, and I have to manage the property economy to some extent!

your extension looks neat though! I just think it's out of scope for me to do this natively in Shapes unfortunately

I disagree. As I see in the Disc component code, you already use ~11 parameters and send it to the shader. It won't be a big overcomplication to add one more. As well as adding "add" operation in the shader to a Vector3 point in space 4 times per single disc. That is a small price for full usage experience Shapes in UI.
Please do not projectile it on just your game experience. Every developer has different. I am sure that many people buy the Shapes just for UI. And that is a big disappointment to understand that it won't work well with UI.

Avatar
Freya Holmér creator

it's not just adding a parameter that's the problem, it's about managing expectations and setting a scope for the project, and currently the scope is that it is a vector graphics rendering library, not a UI library

if I add official support for RectTransform, it communicates the idea that Shapes is supposed to support UI, which makes people's expectations go up in terms of wanting more UI features, which, I just don't have time to do, because it's not a UI library. and turning it into a UI library is an extremely nontrivial task that stretches way beyond just support for recttransform, because UI implies Canvas support, it implies interactions, it implies layout support, and so so so much more

on top of that, a pivot offset like this is a global setting, which adds overheads to all shapes, current and future, for this feature alone, and I'm already pushing it with many of the other things I already have. Just to give an example, the fact that I have coordinate vs uniform scaling, and three different thickness spaces, and three different dash modes, means I have 2*3*3 cases to test, so adding more cases to that is something I don't take lightly, not to mention that all of these need to be implemented not only in shaders, but as a component, an inspector for that component, and the immediate mode API.

like I'm not saying it's impossible! it's totally possible if that's the one feature you want to add, but it's the precedent it sets that I have an issue with

Avatar
Ivan Murzak
Quote from Freya Holmér

it's not just adding a parameter that's the problem, it's about managing expectations and setting a scope for the project, and currently the scope is that it is a vector graphics rendering library, not a UI library

if I add official support for RectTransform, it communicates the idea that Shapes is supposed to support UI, which makes people's expectations go up in terms of wanting more UI features, which, I just don't have time to do, because it's not a UI library. and turning it into a UI library is an extremely nontrivial task that stretches way beyond just support for recttransform, because UI implies Canvas support, it implies interactions, it implies layout support, and so so so much more

on top of that, a pivot offset like this is a global setting, which adds overheads to all shapes, current and future, for this feature alone, and I'm already pushing it with many of the other things I already have. Just to give an example, the fact that I have coordinate vs uniform scaling, and three different thickness spaces, and three different dash modes, means I have 2*3*3 cases to test, so adding more cases to that is something I don't take lightly, not to mention that all of these need to be implemented not only in shaders, but as a component, an inspector for that component, and the immediate mode API.

like I'm not saying it's impossible! it's totally possible if that's the one feature you want to add, but it's the precedent it sets that I have an issue with

I see. That explains why you even don't want to take my package for free for integration into Shapes as a native. In this case, I would better add auto moving component from the current gameObject to a fresh created nested child, no worries :)

I have a proposition completely different. I have the plan to create one more extension for Shapes. That should be editor with Gizmos/Handles in SceneView for creating the Bezier curve. (I asked you, but you deleted("merged" to nowhere because it is gone) my post. So, my proposition to you is don't avoiding any similar extension on top of Shapes. Because that is the place, where people like me take off from you, responsibility for supporting that, and take off some features which you scare to integrate because that multiply test cases. You may force these extensions somewhere. For example, it could be a dedicated page on the Shapes site where would be a list of extensions. Or even add them somewhere else. Because right now looks like many people doing the same stuff by themself. For example UI and Bezier curves. That because Shapes doesn't have that features. And the people don't know about their existing somewhere else. I'm sure that I'm not the first person who did something on top of Shapes. But I can't see them. Where they are? How to find their extensions?

P.S. UI space should work only with "Meters" units. There is no reason to work with any other. Because UI is always scalable by CanvasScaler. And that one works only with UI space "Meters"

Avatar
Freya Holmér creator

possibly yeah, though the asset store already supports extensions to existing plugins, so that would be a good place to put them! I don't really have any plans right now to set up a plugin portal, since it does require upkeep and whatnot as soon as people make more. plus, I can't guarantee they'll be officially supported with changes coming in the future!

as for your bezier extension - I'm sorry it disappeared! usually merging moves your post into the other thread, instead of straight up removing it. I'll see if I can restore it somehow

edit: ah, look like it shows up under "duplicates" and "show description"!