Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by RatchetMiles · Jun 08, 2015 at 10:08 AM · scenemovietexture

How do I load a new scene after video?

I got my script to play a video when the scene starts, but how to I get it to load a new scene when it ends?

 using UnityEngine;
 using System.Collections;
 
 [RequireComponent (typeof(AudioSource))]
 
 public class MyMovie : MonoBehaviour {
 
     // Use this for initialization
     void Start () {
         Renderer r = GetComponent<Renderer>();
         MovieTexture myMovie = (MovieTexture)r.material.mainTexture;
         GetComponent<AudioSource>().clip = myMovie.audioClip;
 
         GetComponent<AudioSource>().Play ();
         myMovie.Play ();
     }
 
     // Update is called once per frame
     void Update () {
 
     }
 }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image helgrind21 · Mar 26, 2020 at 04:31 PM 0
Share

Found a similar question. Look at this answer: http://answers.unity.com/answers/1479738/view.html

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Lunar Soul · Jun 08, 2015 at 04:29 PM

Seems like the easiest way to do it is to take the exact duration of the video then make a timer at the start of the scene that contains the duration then when the timer ends load the new scene

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by YoungDeveloper · Jun 08, 2015 at 04:34 PM

Get movie duration or clip length, launch coroutine which waits that time and loads scene.

 private void Start(){
     StartCoroutine(WaitAndLoad(3f, "MyScene"));
 }
 
 private IEnumerator WaitAndLoad(float value, string scene) {
     yield return new WaitForSeconds(value);
     Application.LoadLevel(scene);
 }

You could also use Invoke.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Soheyl_Zash · Jul 22, 2018 at 05:03 PM 0
Share

Hi I had the same problem and also used this method. sadly it is only good when I load my level for the first time. I added a "New Game" button to my main menu. when the button is pressed, it will load a specific scene with the video in it, video will play, get finished, and finally it will load the next intended scene after desired time. all is well. The problem is, if I go back to main menu and press "New Game" button again, the video will play, but at the end of the video, the scene will not change, it will just stay black like the last frame. I think the Script I used for this function is not working for the second time.

Any thoughts?

PS: I did not used Start or Awake function, also tried OnSceneLoaded and OnEnable with an Empty GameObject that can't be destroyed on load. but no luck.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to go to next scene after the movie played and or if a key was pressed 0 Answers

Calling a scene with a variable 1 Answer

Problem with loading scene 0 in build 1 Answer

Can you create transitions between levels using Application.LoadLevel? 6 Answers

Load Scene X while running Scene X 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges