Unity Stop/Start the simulation

Hi kitware,

Is there a way to set the state of the pulse engine driver. ie start stop restart? also there is an issue when you reload the unity scene related to this the dll seems to still be running in the background and causes graphical issue with the vitals monitoring with the line render going out of the area till it catches up.

Hey Glenn,

You can modify the PulseEngineDriver in our Unity asset.

There is a mechanism for pausing the advancement of the engine
At any time, you can call any of the Serialize method on the engine (SerializeFromFile, SerializeFromString, SerializeToFile, SerializeToString) to create states and set the engine to those a state, we only do it in Awake to initialize the engine, but you could call it in Update if you wanted.

Can you give me a list of steps to reproduce the graphical issue using the provided VitalsMonitor scene?

hey I am running the pulse action on click scene in unity 2021.3.26f1 run the scene for a few seconds then call SceneManager.LoadScene(); with the current scene the bars run out to the left hand side until the sim time catches up.


How do you call SceneManager.LoadScene(); from the editor?

I added a UI button to call it but you can do it on a key press as well if that’s easier for you. inside the brackets you can put the build index number for your scene or the scene name.

I have not tried to reset the monitor before
I would expect we would need to write a script that knows about the monitor and all its components and would clear out the LineRenderer of its data on a scene reset.

I think the default LoadScene is not doing that in our scripts, maybe we could just add clear calls in our PulseDataLineRenderer::Awake

Hi abray, if you add this to the unity pulse engine driver it handles the large time jump that causes the Issue. not the best fix but works.

// Iterate over multiple time steps if needed
int numberOfDataPointsNeeded = (int)Math.Floor(timeElapsed / pulseTimeStep);
int MinDataPoints = 80;
//if there are too many steps skip the drawing of the data bellow and have the sim catch up
if (numberOfDataPointsNeeded > MinDataPoints)
      for (int i = 0; i < numberOfDataPointsNeeded; ++i)
        pulseTime += pulseTimeStep;
        pulseSampleTime += pulseTimeStep;
        data_values = engine.PullData();


here is a code snippet for reloading a scene in unity add this to any update method. Should help with testing.

if (Input.GetKeyDown(KeyCode.R))