How to auto trigger save method.

I have a save method to save the scene, It save the data only when user click save. Can the game trigger the save emthod said every 10 min, so the game can be save even user didnt click the save button?

To elaborate on my comment-

(C#) (I can do javascript as well, but I don’t usually use it)

public bool autoSave;
void Start()
{
    if(autosave)
     {
           StartCoroutine(AutoSaveTimer(600));
     }
}

 IEnumerator AutoSaveTimer(float time)
{
    //Save Game Here
    yield return new WaitForSeconds(time);
    if(autosave)
     {
           StartCoroutine(AutoSaveTimer(time));
     }
}

Short answer: Yes.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Long answer:

function Start() 
{
	SaveEvery10Minutes();
}

function SaveEvery10Minutes()
{
	while( true )
	{
		yield WaitForSeconds( 6000.0 );
	 	Save("Autosave.save");
	}
}

If you don’t want to use yield (for whatever reasons), use an old-school timer :

var mfSaveTimer: float;

function Start() 
{
	mfSaveTimer= 6000.0;
}

function Update()
{
	mfSaveTimer -= Time.deltaTime;
 	if( mfTimer <= 0 )
	{
    		Save("Autosave.save");
    		mfSaveTimer= 6000.0;
	 }   
}