void OnDisable() { if (_video != null) { _video.Dispose(); _video = null; } }
public override void OnInspectorGUI() { DrawDefaultInspector(); try { GpuVideoPlayer myScript = (GpuVideoPlayer)target; if (_video == null || _video.PathForStreamingAssets != myScript.PathForStreamingAssets) { if (_video != null) { _video.Dispose(); } _video = new GpuVideo(myScript.PathForStreamingAssets); } _video.setTime(_video.Duration * _position); GUILayout.Label(_video.Texture, GUILayout.Width(300), GUILayout.Height(200)); _position = GUILayout.HorizontalSlider(_position, 0.0f, 1.0f); } catch (System.Exception) { // :( } }
void OnEnable() { _video = new GpuVideo(PathForStreamingAssets); }
void OnDisable() { _material.mainTexture = null; _video.Dispose(); _video = null; }
void OnEnable() { _video = new GpuVideo("/footage.gv"); _material = this.gameObject.GetComponent <Renderer>().material; _material.mainTexture = _video.Texture; }