Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

R to slow time

Discussion in 'Scripting' started by dark179dev, Jun 20, 2020.

  1. dark179dev

    dark179dev

    Joined:
    Mar 11, 2020
    Posts:
    2
    I've been working on a game for a while (Unity3D), and I wanted to add slow-motion. I want to slow down time when I press R, but I'm getting an error saying " Invalid expression term =."
    This is my code:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class maybeslow : MonoBehaviour
    6. {
    7.     // Start is called before the first frame update
    8.     void Start()
    9.     {
    10.       if (input.GetKeyDown(Keycode.R));
    11.       Time.timeScale = 0.3;
    12.       if (input.GetKeyDown(Keycode.R)) = false;
    13.         Time.timeScale = 1;
    14.     }
    15. }
    16.  
    Am I doing anything wrong here?
     
  2. dark179dev

    dark179dev

    Joined:
    Mar 11, 2020
    Posts:
    2
    Ah, I've fixed it. Never mind.