Forum Discussion
Mickman
12 years agoProtege
WHY !! Gui elements only visible in one eye ??
I have noticed all of my Gui elements only render to one camera. Why & how can I rectify this ?? I'm hoping there's a simple function in the SDK or a tag I can apply that will dupl...
sinoth
12 years agoExplorer
For anyone wanting a really hacky solution, you can do something like this (NOTE: this does not allow you to adjust the depth of the text and can be uncomfortable!)
I was able to get a RenderTexture to display a GUI.Label component. The general procedure is this:
In the inspector, drag the RenderTexture you created onto the "myTexture" public variable on the above script. Should see some text!
void OnGui()
{
GUI.Label(new Rect(Screen.width / 5 * 1, 500, 200, 50), "Testing!");
GUI.Label(new Rect(Screen.width / 5 * 3, 500, 200, 50), "Testing!");
}
I was able to get a RenderTexture to display a GUI.Label component. The general procedure is this:
- Create a RenderTexture (might crank its resolution up to say 1024x1024)
- Create a Material (diffuse) and set its texture to your RenderTexture
- Create an object that will display your UI (a quad works well)
- Assign the material created above to your object
- Attach a script to the object that has something such as:
using UnityEngine;
using System.Collections;
public class draw : MonoBehaviour {
public RenderTexture myTexture;
public GUIStyle style;
void OnGUI()
{
RenderTexture.active = myTexture;
GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
GUI.Box(new Rect(0.0f, 0.0f, 100.0f, 100.0f), "Test!", style);
RenderTexture.active = null;
}
}
In the inspector, drag the RenderTexture you created onto the "myTexture" public variable on the above script. Should see some text!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 months ago
- 1 year ago
- 4 months ago
- 11 days ago