Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
HD148478's avatar
HD148478
Honored Guest
11 years ago

Texture doesn't show up on the Rift

Since I just want a static GUI (no interaction) to pop up whenever I come close to an object, I work with textures.

Here I have this javascript that works well on non-VR projects:

#pragma strict

private var guiShow : boolean = false;

var riddle : Texture;

function OnTriggerStay (Col : Collider)
{
if(Col.tag == "Player")
{
guiShow = true;
}
}

function OnTriggerExit (Col : Collider)
{
if(Col.tag == "Player")
{
guiShow = false;
}
}

function OnGUI()
{
if(guiShow == true)
{
GUI.DrawTexture(Rect(Screen.width/4, Screen.height/4, 1000,500),riddle);
}
}


It basically shows or hides the texture when colliding with an invisible cube. Working perfectly on projects that use a normal camera.

What changes should I make so that the Rift displays this texture? I don't understand why it doesn't show up because it's not even a real GUI o.o

3 Replies

Replies have been turned off for this discussion
  • I decided to completely give up on coding and went back to playmaker. I set up a gui box in 1 minute, with a normal camera it works, with a VR camera it doesn't. This is annoying. Too much. I've been almost 2 days exclusively trying to solve this :evil:
  • I'd recommend using either the new gui system or NGUI. That way you can place any UI object as a worldspace gameobject and not have to deal with the headaches and limitations of OnGUI.
  • Thank you. I could finally achieve what I needed after 3 days of struggling and finally switching to playmaker (thank god). But I appreciate your suggestion for NGUI because it will be great to make some things I had planned.

    Cheers!