New UI methods

For this project I needed to have a user interface to display some variables for the player. For this part of the project, i could have simply gone with a simple user interface, but this is very difficult when working with virtual reality. This is because it can make the player lose their immersion and can make them feel more claustrophobic because something is attached to their eyes.

So, to solve this new problem, I decided to place the UI in the world, using 3D text. However, being new to most of unity’s parts, I needed to learn how to use these 3D text gameObjects. With some quick searches and a few moments filtering through forums, I found the solution. With a reference to the 3D text object, if I get its textmesh component, I can alter the 3D text’s ‘text’ value.


So great, now I can show the player their current wave, lives, and score. But there’s just one problem, I can see the text through my hands.


Well, this certainly was a new problem for me. So I gave it a quick search and the solution was not as simple as I had hoped. To stop the text from appearing over the top of everything, I had to create a new shader. How on earth was I going to do that.
With some searching I found a few different solutions(find them here and here), however they were all from old versions of unity, so I was concerned these shaders may not work. I steadily stumbled through the process of creating a shader, making mistakes here and there and needing to restart to fix the issues I created. But I got there. I created this new text shader, after finding a new font file, I could create 3D text that would be hidden behind other objects in the world! Creating a more reasonable user interface for VR. Hurray!  


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s