Commit aa02771d authored by Sally552sally's avatar Sally552sally
Browse files

корректный перезапуск сцены

parent 25a76bf0
Showing with 12 additions and 22 deletions
+12 -22
......@@ -3,6 +3,7 @@ using Unity.Entities;
namespace AvvyLand.Scripts.ECS.Components.Main
{
public struct SceneLoadedSingletonTag : IComponentData
{
{
public bool isLoad;
}
}
\ No newline at end of file
......@@ -21,6 +21,16 @@ namespace AvvyLand.Scripts.ECS.Systems.InitSystemGroup
protected override void OnUpdate()
{
if (!HasSingleton<SceneLoadedSingletonTag>()) return;
var loading = GetSingleton<SceneLoadedSingletonTag>();
if (loading.isLoad) return;
var entity = GetSingletonEntity<SceneLoadedSingletonTag>();
loading.isLoad = true;
EntityManager.SetComponentData(entity, loading);
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name).completed += operation =>
{
if (HasSingleton<SceneLoadedSingletonTag>())
......
......@@ -193,27 +193,6 @@ namespace AvvyLand.Tests.ECS.Systems.InitSystemGroup
Assert.True(_testSystem.HasSingleton<SceneLoadedSingletonTag>());
}
//[UnityTest, Order(7)]
//public IEnumerator TestSceneLoad()
//{
// var reset = m_Manager.CreateEntity();
// m_Manager.AddComponent<ResetAllComponent>(reset);
// _configSystem.Update();
// var timer = 0f;
// while (MainAppConfig.Instance == null && timer < 10)
// {
// yield return new WaitForSeconds(0.5f);
// timer += 0.5f;
// }
// Assert.True(MainAppConfig.Instance != null);
// _testSystem.Update();
// yield return new WaitForSeconds(3f);
// Assert.False(_testSystem.HasSingleton<SceneLoadedSingletonTag>());
//}
[Test, Order(8)]
public void TestIgnoreReset()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment