Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Video Reference VideoPlayer Component Script Question

Discussion in 'Audio & Video' started by greenpyro, Jul 31, 2017.

  1. greenpyro

    greenpyro

    Joined:
    Jun 22, 2017
    Posts:
    4
    Hey,

    Not great at scripting but I'm learning, wondering if someone can help me..

    I have a game object called videoPlane that has a component VideoPlayer.

    From a script on a separate button I want to get the video player on that plane/gameobject and make it pause.

    I imagine something like this but cant seem to figure it out.
    videoPlane.gameObject.GetComponent<VideoPlayer> () .Pause
     
  2. Deleted User

    Deleted User

    Guest

    That will work. I was having trouble referencing the component, turns out I needed this at the top of the script:
    using UnityEngine.Video;
    Make sure you have that or else it won't recognize the component.
     
    MaratG2 and saleh-alabbas like this.
  3. smamber

    smamber

    Joined:
    Sep 20, 2019
    Posts:
    4
    Your asset is excellent and looks beautiful on an Oculus Rift S. This is probably a dumb question, but I'm a little confused by how to use Video Player to pause an SBS video I'm playing with VR3D Media Viewer. I put the video texture into both the "Default Image" of the VR3D Media Viewer and also into the "Video Clip" of the Video Player. When I try to do a Pause() of the video player in a script, it doesn't work. Could you show a simple example of pausing a VR3D stereo video? Thanks so much!