check this out, might be a timeline bug, haven’t found a known limitation on that
(second async gets lost, doesn’t even start actually, might require the first one to complete?)
check this out, might be a timeline bug, haven’t found a known limitation on that
(second async gets lost, doesn’t even start actually, might require the first one to complete?)
1322239
Nice use case.
Thanks for the repro.
extra repro to isolate vanilla c# from timeline behaviour
code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class _TestSceneLoading : MonoBehaviour
{
public AsyncDataPipe_SO sceneSO;
public SceneReference scene;
public GameObject activateOnLoading, activateOnActivating;
public float delayBeforeLoad = 0, extraDelayBetweenLoadAndActivate = 0;
public void Load()
{
StartCoroutine(LoadThenActivateCO());
}
IEnumerator LoadThenActivateCO()
{
yield return StartCoroutine(LoadCO());
yield return StartCoroutine(ActivateCO());
}
IEnumerator LoadCO()
{
yield return new WaitForSeconds(delayBeforeLoad);
activateOnLoading.SetActive(true);
activateOnActivating.SetActive(false);
sceneSO.async = SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive);
sceneSO.async.allowSceneActivation = false;
}
IEnumerator ActivateCO()
{
yield return new WaitForSeconds(extraDelayBetweenLoadAndActivate);
while (sceneSO.async.progress < 0.9f)
yield return null;
activateOnActivating.SetActive(true);
activateOnLoading.SetActive(false);
yield return null;
sceneSO.async.allowSceneActivation = true;
}
}
so this button is calling both loadings, each one staggered in time like so
load 1
load 2
activate 2
activate 1
this works flawlessly in the editor and on switch
scene loaded size 300MB