0

Here's the program:

   [SerializeField] ARPointCloudManager mArPointCloudManager;
   private int numPointsUpdated = 0;

    // Start is called before the first frame update
    void Start()
    {

        UpdateTextPlanes();

        mArPointCloudManager.pointCloudsChanged += onPointCloudsChanged;

    }

    // Update is called once per frame
    void Update()
    {

        UpdateTextPlanes();

    }

    void onPointCloudsChanged(ARPointCloudChangedEventArgs args)
    {

        foreach (var pointCloudUpdated in args.updated)
        {
            numPointsUpdated += 1;
        }

    }

    private void UpdateTextPlanes()
    {
        PlaneText.SetText(" Point Clouds Updated = " + numPointsUpdated);
    }

The values of the private int variable remains zero & i don't understand why it's happening. I tried making the variable static & placing it at the top of my class before everything else but that didn't make any difference. I've searched around a lot but i can't find either solutions or explanations. I'm a beginner.

ahiyantra
  • 1
  • 2
  • 4
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/242196/discussion-on-question-by-ahiyantra-why-is-the-private-int-variable-in-this-c-p). – Samuel Liew Feb 20 '22 at 15:05

1 Answers1

0

The problem was resolved when i wired all of the variables correctly in my unity project.

ahiyantra
  • 1
  • 2
  • 4