Scene manager
Scene manager
Hello toni and community! I tell you, I have the pixel crushers scene loader system to change scenes with the loading screen, everything works perfectly, but I tried to add a scene as the first scene that is a cinematic, my intention is that when this scene ends the video changes to the first scene with the loading screen again, but I can't do it. please help
Re: Scene manager
Hi,
If I understand you correctly, you want to change scenes after a video has finished playing. This may require a short script. Maybe something like:
If I understand you correctly, you want to change scenes after a video has finished playing. This may require a short script. Maybe something like:
Code: Select all
using System.Collections;
using UnityEngine;
using UnityEngine.Video;
using PixelCrushers;
public class LoadSceneAfterVideo : MonoBehaviour
{
public VideoPlayer introVideo; // Assign these in inspector
public string nextSceneName;
private IEnumerator Start()
{
// Wait for video to start:
while (!introVideo.isPlaying) { yield return null; }
// Wait for video to end or player to cancel:
bool cancelVideo = false;
while (introVideo.isPlaying && !cancelVideo)
{
if (InputDeviceManager.IsKeyDown(KeyCode.Escape)) cancelVideo = true;
}
yield return null;
}
// Load next scene:
SaveSystem.LoadScene(nextSceneName);
}
}
Re: Scene manager
Thankyou Tony works fine, one question my dialogue system runs with new input sistem, y changed this line
if (InputDeviceManager.IsKeyDown(KeyCode.Escape)) cancelVideo = true;
to if (Input.GetButtonDown("Cancel")) cancelVideo = true;
but the video keeps canceling with escape instead of cancel, (cancel is the tab key in my inputmap)
if (InputDeviceManager.IsKeyDown(KeyCode.Escape)) cancelVideo = true;
to if (Input.GetButtonDown("Cancel")) cancelVideo = true;
but the video keeps canceling with escape instead of cancel, (cancel is the tab key in my inputmap)
Re: Scene manager
If you're using the Input System, change this:
to:
and register "Cancel" with the Input Device Manager as shown in the Dialogue System's Input System tutorial video or page 5 of Input_Device_Manager_Manual.pdf included in the Dialogue System.
Code: Select all
if (InputDeviceManager.IsKeyDown(KeyCode.Escape))
Code: Select all
if (InputDeviceManager.IsButtonDown("Cancel"))