Search Unity

How to set Manual HotKey for Time ?

Discussion in 'Animation' started by unity_nztkhD7pHcTizQ, Apr 3, 2018.

  1. unity_nztkhD7pHcTizQ

    unity_nztkhD7pHcTizQ

    Joined:
    Dec 7, 2017
    Posts:
    11
    Hi all,
    I am a Maya Animator,I have to check various Camera Animations in Unity,
    some of them are long in Duration so while checking I frequently use Unity Time attribute(Edit<Project Setting<Time).

    Now if there is some option that I can create some shortcut for Time attribute(Edit<Project Setting<Time), or
    create some Hotkeys that can control it..

    Then,
    Please lemme know ...How to do it??
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Not answering your question directly - do you know you can now animate cameras directly in Maya and import them into Unity?
     
  3. unity_nztkhD7pHcTizQ

    unity_nztkhD7pHcTizQ

    Joined:
    Dec 7, 2017
    Posts:
    11
    Hi ,
    There is no Issue with Camera Animation,
    The problem I am facing is while playing animation in unity,
    Suppose I have 10min animation in unity, I have to check my animation many times,
    and, If I have some issue with my animation on Duration say - 8-9min.

    Now what I do is fast play the animation by increasing Time (Edit<Project Setting<Time),
    Here is my Concern..Can we create any Hotkey that can open Time ?
    As i use it frequently ,I have to go- Edit<Project Setting<Time -every time I use.
     
  4. unity_nztkhD7pHcTizQ

    unity_nztkhD7pHcTizQ

    Joined:
    Dec 7, 2017
    Posts:
    11
  5. unity_nztkhD7pHcTizQ

    unity_nztkhD7pHcTizQ

    Joined:
    Dec 7, 2017
    Posts:
    11
    Please guys ..help me on this..
     
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    Are you talking about the timescale? You can set Time.timeScale from an editor script outside of play mode, that works.

    Copied from our project, you'll have to change it to speed up instead of slow down, but you'll figure that out.
    Code (csharp):
    1.  
    2. public static class EditorCommands {
    3.     [MenuItem("Commands/Toggle Slow Motion %t")]
    4.     public static void ToggleSlowMotion() {
    5.         var current = Time.timeScale;
    6.         if (current == .3f)
    7.             Time.timeScale = 1f;
    8.         else
    9.             Time.timeScale = .3f;
    10.     }
    11. }
    12.  
     
    theANMATOR2b likes this.
  7. unity_nztkhD7pHcTizQ

    unity_nztkhD7pHcTizQ

    Joined:
    Dec 7, 2017
    Posts:
    11
    Hi Baste,
    Thanks for your reply, Yes I am asking for Hotkey for timescale.
    I tried to run the script but got this errors:
    The type or namespace name 'MenuItem' could not be found (are you missing a using directive or an assembly reference?
    The type or namespace name 'MenuItemAttribute' could not be found (are you missing a using directive or an assembly reference?

    I am not the programmer ,pls guide me if I am using it wrongly.
     
  8. unity_nztkhD7pHcTizQ

    unity_nztkhD7pHcTizQ

    Joined:
    Dec 7, 2017
    Posts:
    11
    It works just added
    using UnityEditor;
    using UnityEngine;

    thank you so much..just one thing ryt now its just switching from .3 to 1,
    Can we assign one Hotkey to increase n Another to decrease ??
    But thanks for this script ...