Forum Discussion
JoffreyVR
11 years agoHonored Guest
TextField for writing
Hi everyone, I explain my issue: I want to create a cube (instanciate a prefab) at a certain position. I want that if the player push "I" by example, a window pop in which he would be able to write numbers. Then I want that number to modify attributes of my class. For the moment, my biggest problem is to allow users to enter numbers. I don't find how to do that with TextField. And second problem how to display it VR ? Because when it's unmodifiable text, I know how to do (an example):
If I have to enter numbers in two TextFields, it will be more complicated due to VR.
Hope I made it clear :)
Thank you
- Joffrey
GUI.Label(new Rect(Screen.width / 5 * 1, 370, 200, 20),"");
GUI.Label(new Rect(Screen.width / 5 * 3, 370, 200, 20),"");
If I have to enter numbers in two TextFields, it will be more complicated due to VR.
Hope I made it clear :)
Thank you
- Joffrey
6 Replies
Replies have been turned off for this discussion
- cyberealityGrand ChampionYou should check out the GUI used on the Tuscany demo.
I bet your can rip out some of that code and use it for your purposes. - JoffreyVRHonored GuestOk thank you, I'll check that.
- JoffreyVRHonored Guest:( Sorry, but I don't find a way to do what I want in the Tuscany Assets/Scripts/Objects. Maybe I did it wrong. Any other idea ?
- cyberealityGrand ChampionThe files are in OVR/Scripts (like OVRGUI and OVRMainMenu).
- JoffreyVRHonored GuestAh yes, I've found them, but it wasn't whant I really need. I've found an other to do that. Anyway, thank you for your answers.
- JoffreyVRHonored GuestIn case of anybody needs to write something on a TextField and get the text (c#):
Attribute declaration:private string textFieldStringScale="";
OnGui method: (twice for the VR)textFieldStringScale=GUI.TextField(new Rect(Screen.width / 5 * 1, 250, 80, 20),textFieldStringScale,10);
textFieldStringScale=GUI.TextField(new Rect(Screen.width / 5 * 3, 250, 80, 20),textFieldStringScale,10);
How to get content:script.attribute=Convert.ToSingle(textFieldStringScale); //Convert to float here by example
Don't forget to add:using System;
if you wan't to use Convert class.
Hope it helps :)
- Joffrey
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
- 11 years ago
- 5 months ago