Can't save time from scene 1 when i go on scene 2.

Hi!

I have Counter script so when i start scene 1 my counter starts and when i come to finish and i go to scene 2 my counter reset to 0:0:0 and go from beggining and i need help with how to save time from scene 1 and move it to scene 2. I attached counter script to 3d Text and i attached 3d text to main camera so player can see counter.

Tell me if i need to show scripts or something pls help guys!

Thanks!

yeah i already check that but i dont get it working… i forgot to mantion im newbie :slight_smile:

… and yet you didn’t mention it at all in the OP…

how did you try it?

if you want something to persist between scenes being loaded you need to use that function.

can you make me 1 example or something ?

This is code for counter and can i connect this code with scene 1 and 2 that time will stay same ?

using UnityEngine;
using System.Collections;

public class Timer : MonoBehaviour
{
    private string timedis;
    private float sec;
    private int min;
    private int hou;
    private TextMesh text;
   
    public bool startime = false;
    void Start()
    {
        text = gameObject.GetComponent<TextMesh>();
        sec = 0;
        min = 0;
        hou = 0;
    }
    void Update ()
    {  
        //Count time only whent this is true
        if(startime == true)
        {
            //Adding seconds
            sec += Time.deltaTime;
            //Adding minutes
            if(Mathf.Floor(sec) >= 60){sec = 0; min = min +1;}
            //Adding hours
            if(min >= 60){min = 0; hou = hou +1;}
            //Display time
            timedis = (hou.ToString() + ":" + min.ToString() + ":" + Mathf.Floor(sec).ToString());
            text.text = timedis;
        }
    }
}

please help :frowning:

Post the code you already have, and we can help you. If you don’t post anything to show us how far you’ve come, there’s nothing we can say that will get you where you want to be.