Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Getting position where border of a 9-sliced sprite ends

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by ferretnt, Oct 12, 2018.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    295
    Suppose I have a UIImage referencing a 9-sliced sprite in which is really a thick frame of a button/etc. I want to position a child object so that it precisely covers the centre rectangle of the 9-sliced sprite. How can I compute the extents of the centre sub-rect of the 9-sliced sprite in Canvas space so I can position the child element?