- Home /
Handheld.PlayFullScreenMovie not working with AutoRotation
My project is made to run in Portrait and is set in code to run only in Portrait and Upside Down Portrait. At one point in the game, I use Handheld.PlayFullScreen movie to play a video for the player. I would like for them to be able to rotate their device while watching the video and have the video rotate as well, and when the video is done playing the game switches back to portrait or upside down portrait, however they had it before. The code I am using can be found below. I originally thought the screen.orientation wasn't being set but I'm able to rotate the device and see my game rotate, and then have the video play in portrait. Any help would be greatly appreciated. Thanks.
private ScreenOrientation originalOrientation;
IEnumerator PlayVideo(string videoPath)
{
yield return new WaitForEndOfFrame();
Debug.Log("Allowing all orientations");
AllowAutoRotation( true );
yield return new WaitForSeconds(.1f);
Debug.Log("Playing video");
yield return new WaitForEndOfFrame();
Handheld.PlayFullScreenMovie(videoPath, Color.black, mode);
Debug.Log("Video Finished");
Debug.Log("Setting to Portrait");
AllowAutoRotation( false );
yield return new WaitForSeconds(.1f);
}
void AllowAutoRotation( bool status )
{
if ( status == true)
{
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
originalOrientation = Screen.orientation;
Screen.orientation = ScreenOrientation.AutoRotation;
}
else
{
Screen.autorotateToLandscapeLeft = false;
Screen.autorotateToLandscapeRight = false;
Screen.orientation = originalOrientation;
}
}
Is the problem that now the game is rotating, but you don't want it to?
I would like for them to be able to rotate their device while watching the video and have the video rotate as well, and when the video is done playing the game switches back to portrait or upside down portrait, however they had it before.
Your answer
Follow this Question
Related Questions
Handheld.PlayFullScreenMovie not working on iOS9 0 Answers
Activity Indicator Centered 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
[iOS] Handheld.PlayFullScreenMovie pauses when headset is removed 1 Answer