Skip to content

Instantly share code, notes, and snippets.

@kunofellasleep
Last active October 3, 2017 06:20
Show Gist options
  • Save kunofellasleep/8541808faccd5eecf0d266124713f7b7 to your computer and use it in GitHub Desktop.
Save kunofellasleep/8541808faccd5eecf0d266124713f7b7 to your computer and use it in GitHub Desktop.
Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeScaleController : MonoBehaviour {
[SerializeField] private float speedupScale = 100.0f;
[SerializeField] private float scale = 1.0f;
void Update () {
//キー押されてる時だけ Timescale加速
if (Input.GetKeyDown (KeyCode.LeftControl)) {
Time.timeScale = speedupScale;
}
//キー離したら 元に戻す
if (Input.GetKeyUp (KeyCode.LeftControl)) {
Time.timeScale = 1.0f;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment