From 86731f4bca81cdc3702aa6e53551e192300f4701 Mon Sep 17 00:00:00 2001 From: Alex Meesters Date: Wed, 26 Feb 2025 14:19:23 +0100 Subject: [PATCH] Update EntityComponent.cs Added isInitialized check to OnDestroy() --- Runtime/EntityComponent.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Runtime/EntityComponent.cs b/Runtime/EntityComponent.cs index 613d71b..a0091e4 100644 --- a/Runtime/EntityComponent.cs +++ b/Runtime/EntityComponent.cs @@ -114,6 +114,8 @@ void OnDisable () { /// Event invoked by the Unity Engine when the component is destroyed. /// void OnDestroy () { + if (!isInitialized) + return; var system = GetSystem (); // Remove the entity from the system. system.RemoveEntry ((EntityComponentType)this);