#Help w/ flagging a scene as Cinematic

1 messages · Page 1 of 1 (latest)

coral onyx
#

anyone wanna chime in id be grateful.. the system is pretty complex (for me as is) i just dont wanna do it the wrong way

#

Help w/ flagging a scene as Cinematic

#

I could prefix or suffix the scene name probably.. and run some string method to see if its a Cinematic but that seems lame 😦

#
 string sceneTag = SceneManager.GetSceneByBuildIndex(targetScene).name;
 // hunt for suffix/prefix
heavy wigeon
#

How do you store your cinematic scenes ?

#

What's the difference with a menu or gameplay scene ?

coral onyx
#

same thing for when i load into a cinematic.. i dont need the loading stuff.. just trying to differientiate

coral onyx
#

i could use a component and search for it but not sure thats the best way

#
    private IEnumerator CheckSceneInitialization()
    {
        float timeoutDuration = 5f; // Set a timeout duration of 5 seconds
        float elapsedTime = 0f;

        while(currentSceneInitialization == null && elapsedTime < timeoutDuration)
        {
            currentSceneInitialization = FindObjectOfType<SceneInitialization>();
            elapsedTime += Time.deltaTime;
            yield return null;
        }

        //error checking
        if(currentSceneInitialization == null)
        {
            StartCoroutine(HandleSceneInitializationErrors());
            yield break;
        }
        if(!currentSceneInitialization.CheckStageObjects())
        {
            StartCoroutine(HandleSceneInitializationErrors());
            yield break;
        }

        //Scene Initialization Valid
        StartCoroutine(CalculateSceneLoadingProgress());
        StartCoroutine(CalculateSceneInitializationProgress());
    }```
heavy wigeon
#

I'm not quite sure to follow you. If your cinematic is contained in a dedicated scene that doesn't contain a menu handler thing, menu related stuff won't happen

coral onyx
#

this is the coroutine i run.. if its not the main menu

#

it waits for currentSceneInitialization = FindObjectOfType<SceneInitialization>(); to not be null..

heavy wigeon
#

And vice versa

coral onyx
#

ur right... i can just check if theres a sceneinitialization

#

but that takes time

#

see this is the loadsceneandinitialize method

#

so if its not the main menu scene i bypass this method

#

so i was trying to do the same for cinematics and stuff. but not sure a proper way to do it

#

i could also make a dictionary, list or array or something

#

and manually set them when i get to em..

#

if(targetScene not included in the cinematics list)

heavy wigeon
#

Oh, so this runs on every scene and you just want to know if the scene which is about to be loaded is of a certain kind, that's it ?

coral onyx
#

yea yea

#

sorry bad at explaining things sometimes

heavy wigeon
#

It's alright, I am bad at understanding sometimes x)

coral onyx
#

lol.

#

so thats my problem.. the only thing i know now is if its a main menu or not..

#

if its not.. it does its scene initialization (a loading screen pops up)

#

it either progresses or times out and goes to an error screen

heavy wigeon
#

How do you pass the scene to your method ? string, index ?

coral onyx
#

i dont need any of that to happen if its a cinematic.. and want to bypass like i do if the target scene is main menu

#

but currently i have no way of knowing whats a cinematic scene and whats not

coral onyx
#
    public void NewGame()
    {
        ChangeChapter(0);

        var load = LoadingManager.Instance;
        int sceneIndex = 2;

        if(sceneIndex < SceneManager.sceneCountInBuildSettings)
            load.LoadSceneAndInitialize(sceneIndex);
        else
            Debug.Warning("Theresn't a " + sceneIndex + " scene to load");
    }```
heavy wigeon
#

Do you know you can store a scene reference in a monobehaviour ?

coral onyx
#

i did not know that

#

wow that would be dead simple

heavy wigeon
#

I would have an array/list which holds every scene that are supposed to be a cinematic, and compare the scene you want to load with it

coral onyx
#

so ur saying to populate my gamemanager with an array of my cinematic scenes?

heavy wigeon
#

if the array contains the scene, it is a cinematic

#

or just load a reference stored in said array instead of index

coral onyx
#

i mean i had many ideas... that one is probably the best out of all of em so far

#

i think that will work mate

#

👍 immma do it that way for now

#

thanks so much mate

heavy wigeon
#

Hope it works for your case ! Gotta go tho', I'll come back later to see if you succeed in doing what you want