yuanchunwu Posted October 26, 2022 Posted October 26, 2022 How do I get array elements using Json Class(USC)? I have an error trying to use the getChild(int num, variable var) function.
sweetluna Posted October 26, 2022 Posted October 26, 2022 Hi, our json parser currently support only vec2/vec3/vec4 as an array types. Here an example how you can access this json file { "array_test": [ 0, 0, 1 ] } via Unigine Script: { Json j = new Json(); if (j.load("test.json") == false) return; Json a = j.getChild(0); // Get "array_test" child vec3 v = a.getVec3(); // Get it's value log.message("%f %f %f\n", v.x, v.y, v.z); } Best regards. 1 May RenderDoc/Nsight Graphics/Intel GPA bless you
Recommended Posts