Unity Noob - clicking on video textured object to start the video
So I've literally started using Unity today, and trying to create the following:
2D display, 9 videos, each just showing the first frame. When you click on the videos, they play their second long length.
For some reason I've got one video that plays when you start the project. I created a cube, and applied the video as a texture to it. I then added a script that plays the video texture on start.
What I would like to do, is be able to start that video when I click on it.
I've had a search about, but only found one example of script using a raycast, but this was from 2012 and the script would not compile (something about a colon being present in the script).
Can anyone help?
do you plan on using the new UI system of unity? (are you on 4.6 or 5+?)
I recommend to use raw images (on which you apply your movie texture) and buttons on top of it (if you need a play/pause icon). You may need a script on each of you elements to toggle video and sound every time you click on your raw image. Also if only one video should be played at once there is a bit more to think of...
$$anonymous$$anaged to get a raw image and button created (and had to re layout everything as the canvas thing threw the size of the 'world' completely out of whack), but can't work out how to trigger the video with the button.
Your answer
![](https://koobas.hobune.stream/wayback/20220612070201im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
IsPointerOverGameObject not working with touch input 3 Answers
OnMouseDown not working under Character Conroller 0 Answers
OnMouseDrag() stopped working after few clicks 0 Answers
MoveTexture, straeming video 0 Answers
How can I set opacity of a VideoPlayer? 0 Answers