- Home /
Question by
chodoxxx · Dec 09, 2014 at 12:43 AM ·
videoplaybackhorizontal-slider
How to create slider for control video playback on movie texture?
using UnityEngine; using System.Collections;
[RequireComponent (typeof(AudioSource))] public class GUIButton02 : MonoBehaviour {
public MovieTexture movTexture;
public Texture2D buttonImage1 = null;
public Texture2D buttonImage2 = null;
public Texture2D buttonImage3 = null;
public float hSliderValue =0.0f;
const int orthographicSizeMin = 1;
const int orthographicSizeMax = 7;
private void OnGUI(){
if (GUI.Button (new Rect (320, 530, 30, 30), buttonImage1)) {
renderer.material.mainTexture = movTexture;
audio.clip = movTexture.audioClip;
audio.Play();
movTexture.Play();
}
if (GUI.Button (new Rect (360, 530, 30, 30), buttonImage2)) {
movTexture.Pause();
}
if (GUI.Button (new Rect (400, 530, 30, 30), buttonImage3)) {
movTexture.Stop();
}
hSliderValue = GUI.HorizontalSlider (new Rect (450, 540, 600, 30), hSliderValue, 0.0f, 10.0f);
Camera.main.orthographicSize = Mathf.Clamp(Camera.main.orthographicSize, orthographicSizeMin, orthographicSizeMax );
}
}
that's my script.. anyone can help me? how to create horizontal slider for control movie texture.. thx before..
Comment