Search Unity

Question Convert World Space Size to size in Canvas

Discussion in 'UGUI & TextMesh Pro' started by tylkomat, Feb 8, 2021.

  1. tylkomat

    tylkomat

    Joined:
    Jun 17, 2019
    Posts:
    22
    I have a world space gameobject where different parts are marked with box colliders. On a UGUI ScreenSpace Camera Canvas I want to place other GameObjects at the corresponding positions of the colliders, scaled to the corresponding dimensions.

    I tried different solutions that I found, but in the end only this gist was working: https://gist.github.com/FlaShG/ac3afac0ef65d98411401f2b4d8a43a5

    Unfortunately it does not work for the size. The GameObjects get scaled way too large:
    scale-too-large.png

    It is supposed to look like this:
    scale-correct.png

    The size difference is 72 times. 60 * 1.2 (1.2 probably to inverse the scale of 0.8 of the World Space source)

    The question is now, can I keep this constant? It's a mobile application so screens may be scaled differently.
     
  2. tylkomat

    tylkomat

    Joined:
    Jun 17, 2019
    Posts:
    22
    no one?