Fit canvas to UI Rect

Fit canvas to UIRect

Often you need to place paintcraft canvas somwhere on the scene between UI element, and it's hard to calculate side offset on ScreenCameraAndInput gameObject. To fix this problem you can use utility class which will take data from any specified rect on your UI and set Paintcraft canvas accordingly.

Step by step guide

  1. Add UIRect to your unity ui which will represent Paintcraft canvas

  2. Add RectToCanvasPosition script on this script and select ScreenCameraController on it

Notes

  1. IMPORTANT: Current version doesn't handle UIRect properly if you have canvasScaller on your UI, until new changes is pushed, please take working script from here.

  2. Only ScreenSpace-Overlay supported

  3. UIRect must be transparent and no any another ui element must not overlap paintcraft canvas - otherwise you will just not see it, or you will see it partially (which is in some case could be ok by your design)

Last updated