Advertisement
apieceoffruit

PlayableDirectorSpeedController

Feb 26th, 2022
1,287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. public class PlayableDirectorPlaybackSpeed : MonoBehaviour
  2. {
  3.     [SerializeField] private PlayableDirector _playableDirector;
  4.     [SerializeField] float _playbackSpeed = 1f;
  5.  
  6.     void Update()
  7.     {
  8.         if (_playableDirector && _playableDirector.playableGraph.IsValid())
  9.         {
  10.             Playable playable = _playableDirector.playableGraph.GetRootPlayable(0);
  11.             playable.SetSpeed(_playbackSpeed);
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement