Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Display Markers/Waypoint Symbols in Unity

Discussion in 'AR/VR (XR) Discussion' started by KonradBielecki, Mar 15, 2019.

  1. KonradBielecki

    KonradBielecki

    Joined:
    Jul 13, 2018
    Posts:
    1
    Hello,

    I am currently working on a VR-Project with the HTC Vive in Unity. I Want to place some markers on objects. For that, I created a canvas with the symbol in it. The canvas render mode is in "screen space - camera". I already wrote a script.

    Code (CSharp):
    1.  
    2. public class SymbolControll : MonoBehaviour
    3. {
    4.     public RawImage symbol;
    5.     public Transform target;
    6.     void Update()
    7.     {
    8.         //target behind the player
    9.         if (Vector3.Dot((target.position - Camera.main.transform.position), Camera.main.transform.forward) < 0)
    10.         {
    11.             symbol.enabled = false;
    12.         }
    13.         else
    14.         {          
    15.             symbol.enabled = true;
    16.             symbol.transform.position = Camera.main.WorldToScreenPoint(target.position);
    17.         }    
    18.     }
    19. }
    20. }



    This script was working with the "normal" unity main camera. But as soon I included the Vive plugin, the symbols are not displayed anymore. I coded it after that example:



    I am using Unity Ver. 2018.3.5f1.

    Anyone knows the reason why it's not working anymore has a solution???