Hi, please see screenshot of code.
I’ve got some video clips that load into an array correctly but i can’t figure out why, even with UnityEngine.Video enabled, there is a compiler error with:
videoPlayer.Play();
I can’t seem to access any VideoPlayer scripting functionality - please can you help correct what i’ve done wrong?
thanks
ben
I’m still getting the same error unfortunately… I even tried on a new script and without any editing, I tried to attach to an empty gameobject and the error still popped up… Any suggestions? Thank you.
Kodi nox
Hi xazz, I haven’t found a solution anywhere as to why using UnityEngine.Video does not allow the scripting of video player specific commands.
So I’ve found workarounds I’ll share.
If you create a ‘button’ game object and assign the game object with the video player to the ‘button’ → ‘on click’ function and runtime, there is an option there to VideoPlayer.Play();
It does overcome my problem where I wanted a script to change the videoclips from an array (of 100 MP3’s) and the commands don’t work. So instead, I’ve created a large number of empty gameobjects. Added a video player component to each of them with the individual video clips attached to them.
I then coded a script to allow the original button to change which game object was active and then ‘Invoke’ the videoplayer that starts the video.
does that make sense?
i was quite chuffed to find that long winded workaround that works 100% with there being no literature in recent months on the video player.
Thank you for suggestions