Veggie Saber – Introduction to Unity Development with the Oculus Quest | raywenderlich.com

In this tutorial, you’ll learn how to develop and deploy a game for Oculus Quest in Unity by developing Veggie Saber, a Saber VR game featuring tasty veggies!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4912095-veggie-saber-introduction-to-unity-development-with-the-oculus-quest

Two items of concern poped right up on page 3, of “Veggie Saber.”

The first is that the "inspector doesn’t contain an option "Background Type.’ I chalk that up to maybe the later version of Unity (I’m using 2019.1.9f1) no longer offers that opton?

MY second concern is the statement “Add a Tracked Pose Drive” component! There is no such animal. It’s not included in the list of .cs provided, nor can I fine it in the “Add Componet” option of the inspector.

I admit to being a neophyte - but I have been playing around with Unity for about six months!

Art

Hi Art,

Thank you for pointing out the change with the Camera ‘Background Type’. This has now been renamed in the newer Unity versions as ‘Clear Flags’ . I will update the tutorial image to reflect this.

On the second issue, check that you have the Package “XR Legacy Input Helpers” added to your project. This should be found in the Project view under “Packages”, otherwise please go to the Window->Package Manager and choose to install the missing package.

When you have the “XR Legacy Input Helpers”, you should be able to choose “Add Component” on the Head GameObject and then add a “Tracked Pose Driver” script to keep going on the tutorial.

Thanks for the comments and I will look to update other the change to the Camera.

-Matt (Author)

Would this be difficult to get going for Oculus Go instead of Quest?

I spent a long time looking for quick start guides on how to get something super simple up and running for Oculus Go and found nothing. This guide is exactly what I was looking for… but for Quest!

Hi Elliotw,

The major difference between the Quest and the Go would be having only a single controller. The tutorial would need to be modified to only use one lightsaber and let you begin playing as soon as a single lightsaber is grabbed.

Otherwise, the only other difference might be to avoid using the “V2 Signing(Quest)” when building the application, though this might not have any effects on the Go.

There should be a large overlap between Go and Quest development. Many Go applications can run on the Quest with 6DOF tracking without any changes.

1 Like

Hi Matt…getting the following error when I try to compile and run the final version.

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.XR.Oculus.OculusManifest.UpdateOrCreateNameValueElementsInTag (System.Xml.XmlDocument doc, System.String parentPath, System.String tag, System.String firstName, System.String firstValue, System.String secondName, System.String secondValue) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.1/Editor/OculusBuildProcessor.cs:60)
UnityEditor.XR.Oculus.OculusManifest.OnPostGenerateGradleAndroidProject (System.String path) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.1/Editor/OculusBuildProcessor.cs:90)
UnityEditor.Android.AndroidBuildPipelineInterfaces.OnGeneratePlatformProjectPostprocess (System.String path, System.Boolean strict) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Android/AndroidPostGenerateGradleProject.cs:39)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

Thanks

Hi fitzsbre,

I couldn’t reproduce the build issue when using Unity 2019.2.15f1 and Oculus Android package 1.38.5. What versions of Unity and Oculus Android are you using to build the project?

That said, I did a search and found a similar bug report here (https://forum.unity.com/threads/error-after-upgrading-from-unity-2019-1-13f1-to-2019-2-5f1.748094/). It is described as a bug in the Oculus Android package.

I suggest you:

  1. Try upgrading to the latest Oculus Android package 1.38.5. See if it can now build.
  2. Try the workaround in the forum thread → Modify the AndroidManifest.xml to remove the ‘metadata’ line with a ‘vr-only’ attribute. To do this, edit the file in Assets/Plugins/Android/AndroidManifest.xml to remove the line and then try to build the Android APK.

Hi Brilliant tutorial!, im having trouble with unsliced veggies not being removed after the slice trigger, code looks good in slicer.cs ive even replaced sclicer.cs with the one from final folder just in-case i missed something. I know its probably something simple but i cannot find it
Thanks

Thanks, glad you like it! I will guess that likely ‘Destroy’ is not being called on the original veggie.

Q: are the slices of the veggie being instantiated but the original veggie not removed? It could be that a script is breaking - check the logs for an exception.

I will pull up the project tomorrow and see if I can suggest anything else regarding the Veggie prefab itself.

Some of the sections of code, such as “Grabbing Objects” and “Slicing the Veggies in Half”, have GetComponent( ) methods with no component listed.
I can’t test the game with these empty in the code because they are considered “compiler errors”. Am I just supposed to guess what component is needed in these situations? I mean, it makes sense that the first one is looking for a “Grabbable” script and the other one wants an audio source or something. I’m just checking.

@captain_breadbeard:
This looks like a formatting error on the website is causing GetComponent() to be missing the bracketed text.
I am asking the author team to help get this corrected on the website. Until this is fixed, my suggestion is that you please download the project materials and refer to the ‘final’ project for the correct code for the GetComponent calls.
Thank you for pointing out this problem - I will try to get it amended soon.

@captain_breadbeard - The code block which had been stripped of ‘’ that specified the component type are now fixed. Thanks!

Hi there,
I’ve tried to open the starter project and was not able to do so on Unity 2018.4.18f1

I get the following message:
image

Followed by:
image|453x320

Any ideas on how I can still use this to complete the tutorial?
If I hit continue in the second dialog, the project does open up, but I fear that it will cause issues down the line as I see messages like this on the bottom bar:
image|690x14

Please advise.
Thanks!

Hi @sheepmstr99, the best way to resolve this issue is to install Unity 2019.2.x series - see the Getting Started section. The project was written using 2019.2, and you are trying to downgrade the project which is generally not recommended with Unity.

If you need to work in 2018.4.x, send me a message. I could export the assets as a .unitypackage to be reimported into a clean 2018.4 project.

Hey Matt, thanks for creating this! I was doing fine until I got to the Slicer components, edited the code, and now I’m getting this. Any idea how to fix? Thanks.

UnityEditor.BuildPlayerWindow+BuildMethodException: Error building Player because scripts have compile errors in the editor
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:190
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:95
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

@larsonmattr Can you please help with this when you get a chance? Thank you - much appreciated! :]

Very nice tutorial!
But:
Why do my veggies all tend to the left side and never to the right side?
Greetings Werner

Think i got it!
In GameObject VeggieSource, Transform - I changed X:0 → X:1 and it works fine.

2020-04-13 18_57_07-Veggie Saber – Introduction to Unity Development with the Oculus Quest _ raywend

Thank you for the article. I have been working through your Unity VR book, which uses Unity 2018.

With Unity 2019, do you no longer need or recommend VRTK?

Thank you for the tutorial! I am having some trouble however. I am not getting any errors on my build but the hands will only track one at a time and only after you hit the trigger button on the Oculus Quest controller (so if I hit the trigger on the left controller the left hand begins to move in the scene but the right one freezes at its last location before the trigger squeeze…and vice versa if I hit the right trigger). Also, no animations are happening and the light sabers do not move or track with the hands when collided with and the grip and trigger are engaged. I followed the directions closely, but when I started adding the prefabs I discovered the mesh and shaders/textures were not attached. I am new to all this so did my best to reattach them. I also noticed the Animator tab had the parameters but only the Idle animation had a transition to it. I tried to add the other animations as I understood them and to use the bool parameters and TriggerDown parameter to transition. However, I fear something did not import correctly and that is causing the problem. I am using Unity 2019.20f1. Any help would be appreciated!