public void ReloadScript() { var initialTargetVersion = targetVersion; int localCurrentVersion; do { localCurrentVersion = currentVersion; if (targetVersion <= localCurrentVersion) { targetVersion = localCurrentVersion + 1; } }while (currentVersion != localCurrentVersion); if (targetVersion > initialTargetVersion) { OnScriptChanged?.Invoke(this, EventArgs.Empty); } }