title: Scaling UI exactly as Gameobject
body: <p>I have a gameobject in my scene. I want to show the dimension of the gameobject as shown here: <a href="https://i.stack.imgur.com/11qWd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/11qWd.jpg" alt="enter image description here"></a> So, I created a UI prefab. Now when I am trying to scale the UI (Which us a world UI canvas) prefab. It's not scaling properly! How can I do it? I am trying this now which is indeed not working. Help Needed!</p>
  
  <pre><code>public void setDimension()
  {
      GameObject g = Instantiate(dimUiPrefab);
      BoxCollider b = activeFurniture.GetComponent&lt;BoxCollider&gt;();
      Vector2 cameraViewPort = 
      Camera.main.WorldToViewportPoint(activeFurniture.transform.lossyScale);
  
  
  
      g.transform.position = new Vector3(b.transform.position.x/2,b.transform.position.y +2f, b.transform.position.z);
      g.GetComponent&lt;RectTransform&gt;().transform.localScale = cameraViewPort;
  }
  </code></pre>