#Help w/ flagging a scene as Cinematic
1 messages · Page 1 of 1 (latest)
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
How do you store your cinematic scenes ?
What's the difference with a menu or gameplay scene ?
the difference is theres no sceneinitialization object in the main menu.. so theres no progress or a need for a loading screen
same thing for when i load into a cinematic.. i dont need the loading stuff.. just trying to differientiate
atm i dont store them any way.. thats what im trying to figure out
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());
}```
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
this is the coroutine i run.. if its not the main menu
it waits for currentSceneInitialization = FindObjectOfType<SceneInitialization>(); to not be null..
And vice versa
ohhhh shit
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)
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 ?
It's alright, I am bad at understanding sometimes x)
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
How do you pass the scene to your method ? string, index ?
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
index
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");
}```
Do you know you can store a scene reference in a monobehaviour ?
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
so ur saying to populate my gamemanager with an array of my cinematic scenes?
if the array contains the scene, it is a cinematic
or just load a reference stored in said array instead of index
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
Hope it works for your case ! Gotta go tho', I'll come back later to see if you succeed in doing what you want