Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Creating UI bounding boxes/target boxes around objects

Discussion in 'AR/VR (XR) Discussion' started by RogueStargun, Sep 19, 2020.

  1. RogueStargun

    RogueStargun

    Joined:
    Aug 5, 2018
    Posts:
    286
    Anyone have any idea on the proper way to do this in VR? I'm making an x-wing style game with target boxes around the enemies.

    I wrote bounding box code that draws sprites on a Screenspace overlay UI canvas, but this code does not work in VR because it seems that cam.WorldToScreenPoint and cam.WorldToViewport don't seem to work consistently in VR.

    I also thought about attaching a canvas to every object that needs a bounding box, but there are downsides to this (performance, objects occluding the billboarded canvases)

    What would be the best solution for this use case?