Search Unity

Feedback

Discussion in 'Editor Workflows' started by nareshbishtasus, Jun 28, 2019.

?

Want a timescale slider in game view

  1. Yes

    0 vote(s)
    0.0%
  2. No

    100.0%
Multiple votes are allowed.
  1. nareshbishtasus

    nareshbishtasus

    Joined:
    Jun 11, 2018
    Posts:
    36
    Hi,
    Acutally, while testing ur game in editor u generally want to increase time scale so that unnecessary things can be skipped instead of watching all those things again.
    But, currently for increasing the timescale i have to go to project setting then change timescale and then go back to game view and then again set it back to normal it is very time consuming and frustrating. So i was just wondering if u guys can provide a timescale slider in top of game view then it would make unity more easy to use.

    Tell me what happen of this feedback.
    Unity is love.
    Thank you.
     
  2. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    I understand your wish for this sort of convenience and that the feature would be useful to you and many other users. However, since this is something that can be implemented as a custom editor window with minimal work (only a few lines of code and a tiny window somewhere at the corner), I don't think Unity should spend time on trying to fit this into the UI. It's always a hard balance to find between providing enough features but not cluttering the UI and this is one of the things you only sometimes need regularly for testing and is suited best as an optional addition.

    I've used something like this previously:
    upload_2019-6-28_16-15-27.png

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. public class TimeScaleWindow : EditorWindow
    5. {
    6.     [MenuItem("Window/Time Scale")]
    7.     public static void ShowWindow()
    8.     {
    9.         var window = GetWindow<TimeScaleWindow>("Time Scale");
    10.         window.minSize = new Vector2(30f, EditorGUIUtility.singleLineHeight * 2);
    11.     }
    12.  
    13.     private float maxTime = 10f;
    14.     private float timeScale;
    15.  
    16.     private void OnEnable()
    17.     {
    18.         timeScale = Time.timeScale;
    19.     }
    20.  
    21.     private void OnGUI()
    22.     {
    23.         GUI.enabled = Application.isPlaying;
    24.  
    25.         maxTime = EditorGUILayout.FloatField("Max Time", maxTime);
    26.         if (maxTime < 0)
    27.             maxTime = 0f;
    28.  
    29.         EditorGUI.BeginChangeCheck();
    30.         timeScale = EditorGUILayout.Slider("Time Scale", timeScale, 0f, maxTime);
    31.         if (EditorGUI.EndChangeCheck())
    32.             Time.timeScale = timeScale;
    33.  
    34.         GUI.enabled = true;
    35.     }
    36. }
    You can bring it down to a single row for the window to save space or, with some more advanced editor scripting, add the slider directly on top of the Game View window or simply the Scene View window while playing or where ever it fits well.