Thanks for your reply.
VisionLib has a SDK for Unity, that’s why I talk about it but Unfortunaly they don’t have a forum /:.
I have script this but it’s not working great :
I have a little problem, I would like to read a txt file, modify it and save it. So I use the SimpleJSON from @Bunny83 .
Read it is ok,
Modify is ok
Save it is ok
So where is the problem ? When I save it Unity doesn’t include my modification.
Here my txt file :
{
"type": "VisionLibTrackerConfig",
"version": 1,
"meta": {
"author": "",
"description": "",
"name": "",
"vlTrackingConfig": {},
"uuid": "2bcc7e7f-6220-4a6a-af5b-166b7afd17c6",
"timeCreated": 1601545823,
"timeChanged": 1601545825
},
"tracker": {
"type": "modelTracker",
"version": 1,
"parameters": {
"minInlierRatioInit": 0.6,
"minInlierRatioTracking": 0.42,
"laplaceThreshold": 1,
"normalThreshold": 2.5,
"lineGradientThreshold": 40,
"lineSearchLengthInitRelative": 0.04125,
"lineSearchLengthTrackingRelative": 0.03125,
"keyFrameDistance": 50,
"metric": "cm",
"showLineModel": true,
"models": [
{
"name": "Gaio_ModelTarget_V01",
"uri": "project_dir:Gaio_ModelTarget_V01.fbx"
}
],
"initPose": {
"t": [
-7.307137489318848,
37.529937744140625,
299.53997802734375
],
"q": [
0.995162308216095,
0.09824426472187042,
0,
0
]
}
}
}
}
Here my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using SimpleJSON;
public class ChangeJsonValue : MonoBehaviour
{
string path;
string jsonString;
// Start is called before the first frame update
void Start()
{
path = Application.dataPath + "/StreamingAssets/VisionLib/Gaio/test.vl";
jsonString = File.ReadAllText(path);
JSONNode data = JSON.Parse(jsonString);
foreach (JSONNode record in data["tracker"])
{
record["showLineModel"] = false;
Debug.Log(record["showLineModel"]);
}
}
private void Update()
{
File.WriteAllText(Application.dataPath + "/StreamingAssets/VisionLib/Gaio/sdsd.vl", jsonString);
}
}
In Unity Console the changement is ok, but when I save my file the value is not edit. I don’t understand why !
If someone can help me, that’s will be great !! Thanks