Skip to content

Instantly share code, notes, and snippets.

@SvDvorak
Last active February 15, 2016 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SvDvorak/a15926de8c4f8f519498 to your computer and use it in GitHub Desktop.
Save SvDvorak/a15926de8c4f8f519498 to your computer and use it in GitHub Desktop.
Getting error when shutting down game in editor
MissingReferenceException: The object of type 'EntityBehaviour' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
Entitas.Unity.VisualDebugging.EntityBehaviour.DestroyBehaviour () (at Assets/Libraries/Entitas.Unity.VisualDebugging/Entity/EntityBehaviour.cs:45)
Entitas.Unity.VisualDebugging.EntityBehaviour.onEntityReleased (Entitas.Entity e) (at Assets/Libraries/Entitas.Unity.VisualDebugging/Entity/EntityBehaviour.cs:49)
Entitas.Entity.Release (System.Object owner) (at Assets/Libraries/Entitas/Entity.cs:377)
Entitas.Pool.DestroyEntity (Entitas.Entity entity) (at Assets/Libraries/Entitas/Pool.cs:146)
Entitas.Pool.DestroyAllEntities () (at Assets/Libraries/Entitas/Pool.cs:153)
Entitas.Pool.Reset () (at Assets/Libraries/Entitas/Pool.cs:248)
Assets.TestSetup.OnDestroy () (at Assets/TestSetup.cs:31)
using Entitas;
using Entitas.Unity.VisualDebugging;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Assets
{
public class TestSetup : MonoBehaviour
{
private Systems _systems;
private Pool _pool;
public void Start()
{
_pool = Pools.uiPool;
_systems = new DebugSystems().Add<ReloadSceneSystem>();
_pool.CreateEntity().IsTest(true);
_pool.CreateEntity();
_systems.Initialize();
}
public void Update()
{
_systems.Execute();
}
public void OnDestroy()
{
_systems.ClearReactiveSystems();
_pool.Reset();
}
}
public class ReloadSceneSystem : IExecuteSystem
{
public void Execute()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
SceneManager.LoadScene("Test");
}
}
}
[UiPool]
public class TestComponent : IComponent
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment