Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jortd · Jul 26, 2017 at 11:47 PM · timetime.timescale

Time.timeScale not working properly?

Hi Everyone!

I have a little script:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class CanvasScriptDis : MonoBehaviour {
     
     public Image img;
     public Image img2;
     public Image img3;
     public Text t1;
     public Text t2;
     public Text t3;
     public Button b1;
     public Button b2;
 
     public bool SecondNext;
 
     private void Start()
     {
         img.enabled = false;
         t1.enabled = false;
         t2.enabled = false;
         t3.enabled = false;
         b1.enabled = false;
         b2.enabled = false;
         img2.enabled = false;
         img3.enabled = false;
     }
     // Update is called once per frame
     void Update () {
         if (Input.GetButtonDown("Cancel") && !SecondNext) 
         {
             img.enabled = true;
             t1.enabled = true;
             t2.enabled = true;
             t3.enabled = true;
             b1.enabled = true; 
             b2.enabled = true;
             img2.enabled = true;
             img3.enabled = true;
             SecondNext = true;
             Time.timeScale = 0f;
         } else if (Input.GetButtonDown("Cancel") && SecondNext)
         {
             img.enabled = false;
             t1.enabled = false;
             t2.enabled = false;
             t3.enabled = false;
             b1.enabled = false;
             b2.enabled = false;
             img2.enabled = false;
             img3.enabled = false;
             SecondNext = false;
             Time.timeScale = 1f ;
 
         }
     }
 }

if i press that button, the time doesn't stop for some reason. am i doing something wrong? Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Jul 27, 2017 at 12:42 AM

Setting timeScale to 0 has only one effect, it will make Time.deltaTime to return "0". That means that Time.time is no longer incremented (since it's increased by Time.deltaTime). Everything that relies on deltaTime will basically stop.

However if you move something without deltaTime of course it won't "stop". If you do use Time.deltaTime for any kind of movement, make sure you don't set Time.timeScale somewhere else back to 1.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

69 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to change Time.timeScale to a value bigger than 100? 0 Answers

Time hasn't stopped 1 Answer

Trouble with Time.Timescale 2 Answers

Need help affecting 2d jump with UnscaledDeltatime 0 Answers

Pause Script Only Partially Works? (Gui Toggles, But Time.timeScale Does Not) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges