Hi! I am developing a game in Unity (2020.3.30f1) for Windows using a Leap Motion Controller (5.4.5) and trying to get some of the Convenience Functions working from the documentation example here for IsPinching. This simple example should log to the Console when the left hand is pinching:
using Leap;
using Leap.Unity;
using UnityEngine;
public class ConvenienceMethods : MonoBehaviour
{
void Start()
{
Hand leftHand = Hands.Left;
if(Hands.IsPinching(leftHand))
{
Debug.Log("The left hand is pinching");
}
}
}
Hand tracking is working in my scene using some of the example code from Ultraleap.
Does it matter what GameObject I attach the script to from the example above? Also why is the example from Ultraleap running in Start()? Would have expected this to be in Update() or FixedUpdate().
Currently I am receiving an error from the code "Hand leftHand = Hands.Left;" that "NullReferenceException: Object reference not set to an instance of an object ConvenienceMethods.Start () (at Assets/Scripts/ConvenienceMethods.cs:10)"