public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var player = endLocation.Resolve(graph.GetResolver()); var playable = ScriptPlayable <R3DVideoBehaviour> .Create(graph, template); R3DVideoBehaviour clone = playable.GetBehaviour(); clone.endLocation = player; playback = player; return(playable); }
// Start is called before the first frame update void Start() { // We add the Record3DPlayback script to the node to which this script is attached. // This allows us to load the video later. videoPlayer = gameObject.AddComponent <Record3DPlayback>(); // We load the video from the user-specified filepath videoPlayer.LoadVideo(videoFilePath); // Here we compute which frame should be the starting one. int videoStartingFrame = (int)Mathf.Round(startingFramePercent * videoPlayer.numberOfFrames); // We load that particular frame. videoPlayer.LoadFrame(videoStartingFrame); // And then play the video after the user presses the Play button. videoPlayer.Play(); }