Skip to main content
fixed some typos, added some markdown tags & removed fluff text
Source Link
Pikalek
  • 12.5k
  • 5
  • 45
  • 52

I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain. I

I have timer attached also so the animation doesn’tdoesn't start to walk for 60 seconds. This works fine in the scene when played…but when I navigate into this scene from another home scene the timer delay doesn’tdoesn't work as I guess itsit has been triggered already and has already reached the 60 second mark? I have tried using DontDestroyOnLoadDontDestroyOnLoad but this just recreates the animation in the home scene also. I’m

I'm trying to keep the code as simple as possible and maybe add to the code below to fix it? any ideas? thanks:

void Update ()
{
    if (Time.time > 60)
    {
        transform.Translate (0, 0, Time.deltaTime);
    }
}

I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain. I have timer attached also so the animation doesn’t start to walk for 60 seconds. This works fine in the scene when played…but when I navigate into this scene from another home scene the timer delay doesn’t work as I guess its been triggered already and has already reached the 60 second mark? I have tried using DontDestroyOnLoad but this just recreates the animation in the home scene also. I’m trying to keep the code as simple as possible and maybe add to the code below to fix it? any ideas? thanks

void Update ()
{
    if (Time.time > 60)
    {
        transform.Translate (0, 0, Time.deltaTime);
    }
}

I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain.

I have timer attached also so the animation doesn't start to walk for 60 seconds. This works fine in the scene when played…but when I navigate into this scene from another home scene the timer delay doesn't work as I guess it has been triggered already and has already reached the 60 second mark? I have tried using DontDestroyOnLoad but this just recreates the animation in the home scene also.

I'm trying to keep the code as simple as possible and maybe add to the code below to fix it:

void Update ()
{
    if (Time.time > 60)
    {
        transform.Translate (0, 0, Time.deltaTime);
    }
}
Source Link
patrick
  • 37
  • 1
  • 6

Timer breaks after changing scenes

I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain. I have timer attached also so the animation doesn’t start to walk for 60 seconds. This works fine in the scene when played…but when I navigate into this scene from another home scene the timer delay doesn’t work as I guess its been triggered already and has already reached the 60 second mark? I have tried using DontDestroyOnLoad but this just recreates the animation in the home scene also. I’m trying to keep the code as simple as possible and maybe add to the code below to fix it? any ideas? thanks

void Update ()
{
    if (Time.time > 60)
    {
        transform.Translate (0, 0, Time.deltaTime);
    }
}