how can I freeze the scene while watching a gui window ?

hello, I’m trying to find out how to freeze my scene. I have posters in my 3d scene, and when I click on them, a gui window appears on the screen to read the poster more easily. what I want is to freeze the 3d scene behind while the gui window is on. and re-activate the movement when we close the window.

thanks for your help !!!

To pause the scene

Time.timeScale=0;

To resume the scene

Time.timeScale=1;

When you want to freeze scene:

Time.timeScale = 0;

When you want to resume:

Time.timeScale = 1.0;

If you want movement in some areas you can wrap everything that has continuous movement with something like:

if(!paused) {
    //code that moves objects
} else {
    /*Freeze position and rotation of any rigidbodies
      and loop through in a function all rigidbodies 
      to get their current velocity. Later apply
      the same force on resume.*/
}