Proper procedure for setting and using config file variables

I’m trying to programmaticaly set the camera Id for the astra camera and it doesn’t seem to work. When I set the camera id manually in the config file, it works, so I know the correct ID of the camera. The way that I’m trying to achieve this is starting at cameraId = 0:
Nuitrack.SetConfigValue(“AstraProPerseeDepthProvider.Windows.CameraID”, $"{cameraId}");
SensorColor = ColorSensor.Create();
SensorColor.OnUpdateEvent += DetermineColorSensorId;

Then call Nuitrack.Update ever 100 milliseconds to see if I can get the color frame event to trigger

If the event doesn’t fire after 5 seconds, I increment the cameraId, then do the following:

SensorColor.OnUpdateEvent -= DetermineColorSensorId;
SensorColor = null;

Then run from Nuitrack.setconfig through Nuitrack.Run again in the previous code. And obviously the Nuitrack.Update every 100 msec.

I run from cameraId 0 to 2.

Can someone please tell me what I’m doing wrong here or tell me what the proper procedure is for setting the config file variables from code and then have the system be able to use them?

Hi Steven,

Please provide us with full source code of what you’re trying to achieve.

Also please try to set the second argument (this worked in our case):

Nuitrack.SetConfigValue(“AstraProPerseeDepthProvider.Windows.CameraID”, "0");