UnityEditorInternal.AnimationKeyTime.Time C# (CSharp) Method

Time() public static method

public static Time ( float time, float frameRate ) : AnimationKeyTime
time float
frameRate float
return AnimationKeyTime
        public static AnimationKeyTime Time(float time, float frameRate)
        {
            return new AnimationKeyTime { 
                m_Time = time,
                m_FrameRate = frameRate,
                m_Frame = Mathf.RoundToInt(time * frameRate)
            };
        }

Usage Example

Example #1
0
        public override bool PlaybackUpdate()
        {
            if (!playing)
            {
                return(false);
            }

            float deltaTime = Time.realtimeSinceStartup - m_PreviousUpdateTime;

            m_PreviousUpdateTime = Time.realtimeSinceStartup;

            float newTime = time.time + deltaTime;

            // looping
            if (newTime > state.maxTime)
            {
                newTime = state.minTime;
            }

            m_Time = AnimationKeyTime.Time(Mathf.Clamp(newTime, state.minTime, state.maxTime), state.frameRate);

            ResampleAnimation();

            return(true);
        }
All Usage Examples Of UnityEditorInternal.AnimationKeyTime::Time