I am trying to play a video using Unity's VideoPlayer which I have attached to the camera. I want the user to be able to enter the file path of a local video file and the VideoPlayer should then play the video. I got this working fine but I can't seem to handle exceptions when the user enters a path that is not valid, for instance:
try
{
videoPlayer.url = @"C:\blah";
}
catch
{
print ("error");
}
does not print "error" but instead continues execution and gives me an error in the console saying "Can't play movie [C:\blah]"
----------
I can't think of any reason why this error shouldn't be caught by using the try catch method. I am using the latest version of Unity.
If you cannot use the try catch method to catch this exception, then I need a way to test if the url is valid and will play properly (e.g. the file is not corrupt)
↧