Sorry but I just can’t seem to get it to work, I have one scenario that works when I assign it in the inspector. But I want to have this application on VR headsets so I put all the data in streaming assets folder and I’m loading the scenario using:
string streamingScenarioFilename = Application.streamingAssetsPath + "/Data/scenarios/testPatient.json";
Debug.Log("Scenario from Streaming assets, file path: " + streamingScenarioFilename);
if (!scenario.SerializeFromFile(streamingScenarioFilename))
{
Debug.unityLogger.LogError("PulsePhysiologyEngine", "Unable to load scenario file "+ streamingScenarioFilename);
return;
}
The if does not run so I’m assuming it can find the scenario. However, I get the error from this if:
scenario.GetPatientConfiguration().SetDataRootDir(Application.streamingAssetsPath+"/Data/");
if (scenario.HasEngineState())
{
Debug.Log("Scenario has engine state");
// This code is assuming the scenario engine state file is relative to the application streaming path
string state = Application.streamingAssetsPath+"/Data/states/"+scenario.GetEngineState();
Debug.Log("Engine State path is " + state);
if (!engine.SerializeFromFile(state, scenario.GetDataRequestManager()))
{
Debug.unityLogger.LogError("PulsePhysiologyEngine", "Unable to load state file " + state);
return;
}
}
else if(scenario.HasPatientConfiguration())
{
if (!engine.InitializeEngine(scenario.GetPatientConfiguration(), scenario.GetDataRequestManager()))
{
Debug.unityLogger.LogError("PulsePhysiologyEngine", "Unable to initialize patient");
return;
}
}
But apparently my scenario does NOT have an engine state and it goes to the second if and i get the error: “Unable to initialize patient”
However, this is in my scenario JSON:
"Name": "testScenario",
"Description": "My created scenario.",
"EngineStateFile":"Soldier@0s.pbb",
"DataRequestManager": {
"DataRequest":
[
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "HeartStrokeVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "BloodVolume", "Unit": "L" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "ExtravascularFluidVolume", "Unit": "L" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "CardiacOutput", "Unit": "L/min" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "HemoglobinContent", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "CentralVenousPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "PulmonaryCapillariesWedgePressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" }
]
},
So it does have a state file and data request manager. So I’m not sure why the state file isn’t visible to the scenario driver.
I tried hard coding the state in too but that didn’t work either and I get the same Unable to initialize patient error:
string state = Application.streamingAssetsPath+"/Data/states/Soldier@0s.pbb";