Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Brad Pizzimenti14,640 Points
I cannot pickup the basketball object and I'm getting a NullReferenceException
Though the project will run, I'm getting a recurring null ref exception in the conosle:
NullReferenceException: Object reference not set to an instance of an object ControllerInteraction.OnTriggerStay (UnityEngine.Collider other) (at Assets/Scripts/ControllerInteraction.cs:37)
Line 37 that it refers to is my IF statement and reads as follows:
if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger) && other.GetComponent<Rigidbody>() != null && fixedJoint == null)
It seems that the null reference it's complaining about is "device" but device is instantiated in FixedUpdate and I had not trouble with the material.color test we ran in the previous video.