Make a VR Game With Unity and Google Cardboard

Did you try following the instructions in the Note, where we ask you to turn off distortion correction? There appears to be a bug in Unity right now, where the UI doesn’t show up properly on render textures, so turning distortion correction off for now seems to fix it.

Oh ! I missed the version in that note, because I thought that it was related to previous versions, before it got fixed. My understanding is that bug came back again in latest version of Unity and downgrade was not an option for me.
Just now I realized that you were referring to version that I have.

Sorry, that indeed fixed the issue :slight_smile:
Thank you for the article and for quick followup !

Hello,
How to add the button for cardboard app i can’t able to add in middle of the line.Anyone please help me, I am new to unity . Thanks in advance

Thank you for making such a well documented tutorial! One thing had me stumped for a bit that might help others to know, after switching the distortion correction on Gvr Viewer to none the button and text showed up but the stereo alignment was off and I had to pair my phone with the cardboard viewer to correct it. Obvious to me now but I didn’t know what was going on for a bit.

Ray, very cool to do this. I am running into an issue with the GvrMain. I am getting the message “The associated script cannot be loaded. Please fix any compile errors and assign a valid script”.

Scanning the boards it looks like this is a fairly common issue, but none of the solutions seemed to make sense given that I am just loading standard assets. I have gone back to download the latest versions of everything just to make sure I wasn’t missing something.

Any advice?

Hmmm
 yeah, Googling for answers don’t seem to help much. It looks like Unity sometimes gets confused with the files that are included in the project and needs a little nudge to re-generated the meta data that tracks them all. If this is happening with the Cardboard plugin, you might want to try just removing the scripts from your project folder, and then re-adding it and see if that helps.

Hi
this was cool.i tried it but can this will be playable in every device,GVRViewer script has the option to certain mobiles like Nexu5,Nexus 6,Galaxy note 4 etc.How can i build this game for all devices.

That’s not really hard to create a VR game actually if there is a pre-built API in Game Engine. The vast majority of game engines now support the Virtual Reality and it is great! For example you can now great a game with Unity without any problems.

Right now, the virtual reality gaming industry is dominated by the major consoles, Xbox (Microsoft) and PlayStation (Sony). Unity already provides the possibility to make a build of a game for XBox or Sony PS. So you can just add a VR API. You can read more about it for example here : https://appreal-vr.com/blog/how-to-make-vr-game/

The procedure is the same for Oculus, Samsung or Google headsets so there is no problem to make your game truly multiplatform. But Unity is perfect for mobile games, projects with low budget and it has a huge community of developers that can help you to make your game better.

Hi Sir, Thank you for your great work.

When I import googleVRfor unity it give me this error:

"Failed to load ‘Assets/Plugins/x86_64/audioplugingvrunity.dll’ with error 'The specified module could not be found.
'.
UnityEditor.DockArea:OnGUI() "

can you help me?
unity version : 5.3.4p3

Hmmm
 it looks like there are a number of suggestions over on this thread that might help. Are you trying this on a Windows machine? It looks like installing the Visual Studio Run-time components might help here.

Very good tutorial @tkerpelman :slight_smile:

Regarding your question about running Cardboard Games / Apps on Gear VR, You can not run cardboard Apps on Gear VR and vice versa. However there are certain ways to build single app in Unity which works on both platforms.

thanks alot,
now it give another error and dont show game screen

https://i.imgsafe.org/e01be8fd39.jpg

@amanver,
You need to add to GvrViewerMain the following components which already exists on Main Camera:
GUI Layer
Flare Layer
Skybox
Audio Listener.

When you will add the GUI Layer , a camera component will be added automatically, so after that you will be able to see the game.

Hope it will help :slight_smile:

Thanks @poz ;
your idea tackled the error.:slight_smile:

but give another error that is this:
NullReferenceException

https://i.imgsafe.org/2bc56e6dfc.jpg

thanks.

Great tutorial! This is exactly what i was looking for considering that im just begining my journey with Unity and VR.

Im at the start of the tutorial and i have just imported the GoogleVR packages, attached GVRMain to my scene, and changed the position and rotation parameters. But when i try to run the game in the editor i get an error saying
“There are no audio listeners in the scene. Please ensure there is always one audio listener in the scene”

and nothing shows up in the 3D scene.

I also get a deprecation warning like so

“OnLevelWasLoaded was found on GvrViewer
This message has been deprecated and will be removed in a later version of Unity.
Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed”

Im running Unity 5.4.0. What should i do to get the starter Ninja running on the editor? Am i missing something or do i need to update the project for the newer versions of unity?

Hello,

Thank you for the tutorial. I have installed Unity 5.4.1, Xcode 8.0, and have the new iOS 10 on my iPhone. Things work well inside Unity when I press play and can see the VR view correctly.

However, when I try to build and run to the iPhone it launches Xcode, but then when I send it to the attached iPhone it starts up and just shows a black screen. There are also many code deprecation warnings showing in Xcode and the code stops in the debugger. Trying to continue the code execution terminates the app on the iPhone.

@tkerpelman
Thank you for this great topic.
Please I need to ask you some questions
Can I make a VR Game with touches input and sound input using Google cardboard?

That’s mean:
At my game I want the palyer be able to unlock levels by saying certain word.
and the player should be able to drag and drop virtual object from place to another place
Can I do this using Google cardboard?

Thank you in advance

Well, you couldn’t really do this with the player actually touching the screen. That would just be plain awkward to use. Instead, I would propose a system where you rely on listening to a Triggered event as a way for the user to “pick up” the object they’re looking at, and then listen to a similar event as a way for the user to drop the object they’re carrying.

Sound input should work, although that’s not really a Google cardboard thing; that’s just using Unity’s Microphone class. The tougher part would probably be doing the speech-recognition – you might need a cloud-based service (like the Google Speech API) to handle that

Hi Amanver,

I am facing the same issue with nullpoint exception. Did you figure out how to do this ?

Hi Todd, 1st thank you for this tutorial got it working loads of fun. however I am curious if you would have any insight on how to swap the 3d blender models out. Whenever I try to replace the model or even modify the original only the original elements will render out in the game. Even trying to just add a hat to the slime character does not render in game. Any ideas or can you point me in the right direction?