Reply by k3kalinix | 2024-08-19 21:42:50
It was like that already.
Reply by k3kalinix | 2024-08-19 21:42:50
It was like that already.
Reply by newbietechbro | 2024-08-19 21:43:17
you mean in the code i sent you?
Reply by k3kalinix | 2024-08-19 21:43:23
Yes
Reply by newbietechbro | 2024-08-19 21:43:25
it wasn’t disabled
Reply by k3kalinix | 2024-08-19 21:43:34
Then you can revert it.
Reply by k3kalinix | 2024-08-19 21:43:53
Just make sure to use UnloadScene Coroutine.
Reply by newbietechbro | 2024-08-19 22:15:27
it still doesn’t work
Reply by k3kalinix | 2024-08-19 22:15:42
Probably you did something wrong.
Reply by k3kalinix | 2024-08-19 22:16:03
I tested it on my side.
Without coroutine, it wont unload.
Reply by newbietechbro | 2024-08-19 22:16:19
I followed what you said to use the coroutine
Reply by k3kalinix | 2024-08-19 22:16:42
I can’t check the code right now.
I’m on the phone.
Reply by k3kalinix | 2024-08-19 22:16:51
Will check tomorrow.
Reply by newbietechbro | 2024-08-19 22:17:00
if (!string.IsNullOrEmpty(currentAdditiveScene) && SceneManager.GetSceneByName(currentAdditiveScene).isLoaded)
{
/* DISABLED
Debug.Log("CurrentAdditiveScence: " + currentAdditiveScene);
Debug.Log("Unloading additive scene: " + currentAdditiveScene);
SceneManager.UnloadSceneAsync(currentAdditiveScene, UnloadSceneOptions.UnloadAllEmbeddedSceneObjects);
Debug.Log(“Additive scene unloaded”);
currentAdditiveScene = null;
*/
if (currentAdditiveScene == “MarkerBall”)
{
StartCoroutine(UnloadScene(3));
}
else if (currentAdditiveScene == "MarkerModels")
{
StartCoroutine(UnloadScene(2));
}
}
Reply by newbietechbro | 2024-08-19 22:17:09
private IEnumerator UnloadScene(int buildIndex)
{
Debug.Log(“Current additive scene is” + currentAdditiveScene);
Debug.Log("Unloading Scene: " + buildIndex);
yield return SceneManager.UnloadSceneAsync(buildIndex);
}
Replying to newbietechbro’s Message
Reply by newbietechbro | 2024-08-19 22:17:00
if (!string.IsNullOrEmpty(currentAdditiveScene) && SceneManager.GetSceneByName(currentAdditiveScene).isLoaded)
{
/* DISABLED
Debug.Log("CurrentAdditiveScence: " + currentAdditiveScene);
Debug.Log("Unloading additive scene: " + currentAdditiveScene);
SceneManager.UnloadSceneAsync(currentAdditiveScene, UnloadSceneOptions.UnloadAllEmbeddedSceneObjects);
Debug.Log(“Additive scene unloaded”);
currentAdditiveScene = null;
*/
if (currentAdditiveScene == “MarkerBall”)
{
StartCoroutine(UnloadScene(3));
}
else if (currentAdditiveScene == "MarkerModels")
{
StartCoroutine(UnloadScene(2));
}
}
Reply by newbietechbro | 2024-08-19 22:17:34
this is where i call UnloadScene
Replying to newbietechbro’s Message
Reply by newbietechbro | 2024-08-19 22:17:09
private IEnumerator UnloadScene(int buildIndex)
{
Debug.Log(“Current additive scene is” + currentAdditiveScene);
Debug.Log("Unloading Scene: " + buildIndex);
yield return SceneManager.UnloadSceneAsync(buildIndex);
}
Reply by newbietechbro | 2024-08-19 22:17:47
and then in the later part of the script this is the IEnumerator
Reply by k3kalinix | 2024-08-19 22:17:49
Test it by pressing a key.
Reply by k3kalinix | 2024-08-19 22:19:54
Send the whole code to ChatGPT.
It will make it clear.
Reply by newbietechbro | 2024-08-19 22:20:12
i’ve been doing that already