I have a script which is in a namespace. HandTrackingValue.cs
using System.Collections.Generic;
using UnityEngine;
namespace Mediapipe.Unity.HandTracking
{
public class HandTrackingValue
{
public readonly List<Detection> palmDetections;
public readonly List<NormalizedRect> handRectsFromPalmDetections;
public readonly List<NormalizedLandmarkList> handLandmarks;
public readonly List<LandmarkList> handWorldLandmarks;
public readonly List<NormalizedRect> handRectsFromLandmarks;
public readonly List<ClassificationList> handedness;
public string value;
public HandTrackingValue(List<Detection> palmDetections, List<NormalizedRect> handRectsFromPalmDetections,
List<NormalizedLandmarkList> handLandmarks, List<LandmarkList> handWorldLandmarks,
List<NormalizedRect> handRectsFromLandmarks, List<ClassificationList> handedness)
{
this.handedness = handedness;
}
void Update()
{
value = handedness.Count.ToString();
}
}
}
I have another script which is in a MonoBehaviour. This script below , ShootingStuff.cs is trying to access “value” variable from the above script. But it is throwing " Not set to instance of an object".
ShootingStuff.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mediapipe.Unity.HandTracking;
public class ShootingStuff : MonoBehaviour
{
Mediapipe.Unity.HandTracking.HandTrackingValue a;
void Start()
{
}
void Update()
{
Debug.Log(a.value.ToString());
}
}
Both of these scripts are in Scripts folder. But, ShootingStuff.cs is directly within Scripts folder whereas HandtrackingValue.cs is in Scripts->HandTrackingFolder->HandTrackingValue.cs.
I am unable to access “value” from HandTrackingValue.cs into ShootingStuff.cs. WHere am I going wrong?