Hi there,
I wish to create a videoplayer and it only plays when I press a certain button. When it starts to play, it can automatically jump to the frame I specified. I can make the video jump to the frame while using 'play on awake' function, but I cannot do it when I need to press the button. I can also make it works when I press the button twice but is there any way to make it happen at the first time when I press the button? Here is my script when it works when I press the button twice.
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class skip : MonoBehaviour {
public VideoPlayer video;
void Update () {
if(Input.GetKeyDown(KeyCode.Space))
{
video.Play();
if(video.isPlaying)
{
video.frame = 500;
}
}
}
}`
Thanks in advance.
↧