Browse Source

fix sequencer bug

make EnginesRoot dispose itself
tags/2.7
sebas77 6 years ago
parent
commit
df18cce5dd
4 changed files with 12 additions and 5 deletions
  1. +1
    -1
      Svelto.ECS/EnginesRoot.Engines.cs
  2. +8
    -1
      Svelto.ECS/EnginesRoot.Entities.cs
  3. +1
    -1
      Svelto.ECS/EnginesRoot.Submission.cs
  4. +2
    -2
      Svelto.ECS/Sequencer.cs

+ 1
- 1
Svelto.ECS/EnginesRoot.Engines.cs View File

@@ -12,7 +12,7 @@ using Svelto.ECS.Profiler;

namespace Svelto.ECS
{
public partial class EnginesRoot : IDisposable
public partial class EnginesRoot
{
#if ENGINE_PROFILER_ENABLED && UNITY_EDITOR
static EnginesRoot()


+ 8
- 1
Svelto.ECS/EnginesRoot.Entities.cs View File

@@ -11,7 +11,7 @@ using Svelto.ECS.Profiler;

namespace Svelto.ECS
{
public partial class EnginesRoot : IDisposable
public partial class EnginesRoot: IDisposable
{
/// <summary>
/// Dispose an EngineRoot once not used anymore, so that all the
@@ -26,6 +26,13 @@ namespace Svelto.ECS
foreach (var engine in _disposableEngines)
engine.Dispose();
GC.SuppressFinalize(this);
}

~EnginesRoot()
{
Dispose();
}

///--------------------------------------------


+ 1
- 1
Svelto.ECS/EnginesRoot.Submission.cs View File

@@ -14,7 +14,7 @@ using Svelto.ECS.Profiler;

namespace Svelto.ECS
{
public partial class EnginesRoot : IDisposable
public partial class EnginesRoot
{
void SubmitEntityViews()
{


+ 2
- 2
Svelto.ECS/Sequencer.cs View File

@@ -104,7 +104,7 @@ namespace Svelto.ECS
_steps = steps;
}

public void Next<C>(IEngine engine, C condition, EGID id) where C:struct,IConvertible
public void Next<C>(IEngine engine, C condition, EGID id) where C:struct, IConvertible
{
C branch = condition;
var to = (_steps._steps[engine] as To<C>);
@@ -120,7 +120,7 @@ namespace Svelto.ECS
var to = _steps._steps[engine];
var steps = to.engines;
if (steps != null)
if (steps != null && steps.Length > 1)
for (var i = 0; i < steps.Length; i++)
steps[i].Step(id);
else


Loading…
Cancel
Save