Time.timeScale does nothing

Here is my code…

functrion Update(){

if(Input.GetKeyDown("s")){
		if(Time.timeScale == 1.0){
				Time.timeScale = 0.1;
				print("Time Scale: 0.1");
			}
		else{
			Time.timeScale = 1.0;
			print("Time Scale: 1.0");
			}
		}
	}
}

So some odd reason, this isn’t working. The tutorial video I’m using has this exact same code and his works. I checked Unity’s script refrence page and it suggested using Time.fixedDeltaTime = Time.timeScale with it, this did nothing as well. Infact, the print commands only worked for the first two times and then never again. I heard there was a big change to Time.timeScales behaiver when used with function Update(), but that was mainly with have timeScale set to 0. For me, no value works at all.

The only other code I have is two transform commands to make a cube spin and move, nothing else. So I know there’s no other code interferring with this.

Please help?

In his video, the code is different than the one you posted. His code:

transform.Translate(0,Time.deltaTime * speed,0);

Since Update gets called every frame, and you change the position by a constant, you won’t notice any difference whatsoever by changing Time.timeScale, since Unity’s framerate doesn’t change much (at least I think). What you have in your code is called framerate-dependant code, since if you increase the framerate, the speed of the object will also increase. That’s why they multiply the translation by Time.deltaTime, so that the code will run the same on a low-end and high-end computer the same, making it framerate-independant.
Time.timeScale will only have effect on framerate-independant code.