I don’t want to change it’s properties, I want to know if you can make a public variable that looks like that
Probably with a custom editor.
Alternatively, you could use a Vector2 to define the anchor points.
Top Left, for example, would be Vector2(0, 1).
Then in code, you would set the RectTransform’s anchorMin and anchorMax to this value. The same would apply for setting the RectTransform’s pivot except you would use the pivot property (goes without saying).
Unfortunately the editor code for this is very specific to RectTransform.
Here is where the RectTransformEditor draws it:
And it relies on this LayoutDropdownWindow to do all the leg work:
And if you look in LayoutDropdownWindow it relies completely on its target being a RectTransform.
So not only are they marked ‘internal’ (so the only way to even gain access to them would be via reflection, this is doable, just requires some odd code to pull off and has the chance to break when Unity changes version). But the more difficult aspect is that it explicity works only with RectTransform, so hacking it to work with something else isn’t going to work so much.
You’d have to write your own custom editor that look/behaved similar while not actually using Unity’s code.
Unless you are trying to get this to work with RectTransform, just changing the editor around a little bit… in which case. Sure, you’ll just have to write a reflection wrapper around ‘LayoutDropdownWinow’.