From 54ec8da1fe1ef2a1c08cc4d8588582e3691e141f Mon Sep 17 00:00:00 2001 From: Aaro Varis Date: Sun, 19 Oct 2025 21:38:22 +0300 Subject: [PATCH] invalid optimization test --- BoneSync/Sync/Components/SyncableBase.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/BoneSync/Sync/Components/SyncableBase.cs b/BoneSync/Sync/Components/SyncableBase.cs index e53c0f6..92e88c9 100644 --- a/BoneSync/Sync/Components/SyncableBase.cs +++ b/BoneSync/Sync/Components/SyncableBase.cs @@ -85,10 +85,23 @@ namespace BoneSync.Sync.Components public bool isStale => Time.realtimeSinceStartup - _lastSyncTime > 30f; public bool isOwner => _ownerId == BoneSync.lobby.GetLocalId(); - public bool isValid => _GetIsValid(); + public bool isValid + { + get + { + if (_isInvalidCached) return false; + bool valid = _GetIsValid(); + if (valid) return true; + _isInvalidCached = true; + return false; + } + + } + private bool _isInvalidCached = false; private bool _GetIsValid() { + try { if (this == null) return false;