Page 1 of 1

Change Transitions on the Fly for Standard Scene Transition Manager

Posted: Thu Jan 18, 2024 11:04 pm
by cptscrimshaw
Hi Tony,

I'd like to be able to change the OnTransitionEnd Unity events when loading a scene on the fly depending on different situations (e.g., loading into a cutscene vs. just loading the scene normally). I was playing around with different options, but figured there's a "best" way to do this. Any thoughts? See the attached screenshot for specificity.

https://ibb.co/yqyC26d

Thanks as always for the fantastic support!

Re: Change Transitions on the Fly for Standard Scene Transition Manager

Posted: Fri Jan 19, 2024 9:17 am
by Tony Li
Hi,

The StandardSceneTransitionManager's methods are virtual so you can extend them with your own behavior. For example, say you have a special component CutsceneManager in your cutscene scenes:

Code: Select all

public class CutsceneManager : MonoBehaviour
{
    public void PlayEntryCutscene() { ... }
}
You could override EnterScene() to call its method:

Code: Select all

public class MySceneTransitionManager : StandardSceneTransitionManager
{
    public override IEnumerator EnterScene()
    {
        var cutsceneManager = FindFirstObjectByType<CutsceneManager>();
        if (cutsceneManager != null) cutsceneManager.PlayEntryCutscene();
        yield return base.EnterScene();
    }
}
Then replace your StandardSceneTransitionManager component with your subclass.

Re: Change Transitions on the Fly for Standard Scene Transition Manager

Posted: Fri Jan 19, 2024 5:54 pm
by cptscrimshaw
Worked like a charm! Thanks as always for your excellent, detailed, and superfast support.

Re: Change Transitions on the Fly for Standard Scene Transition Manager

Posted: Fri Jan 19, 2024 7:02 pm
by Tony Li
Happy to help!