diff --git a/CHANGELOG-PRERELEASE.md b/CHANGELOG-PRERELEASE.md index 51ba66336..93f7c1460 100644 --- a/CHANGELOG-PRERELEASE.md +++ b/CHANGELOG-PRERELEASE.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog]. ### Removed ### Fixed +- RigidBody Joint can be broken `#683` ### Security diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba0fd0db..394fadd7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog]. ### Removed ### Fixed +- RigidBody Joint can be broken `#683` ### Security diff --git a/Editor/Processors/TraceAndOptimize/ComponentDependencyCollector.cs b/Editor/Processors/TraceAndOptimize/ComponentDependencyCollector.cs index f8a964b25..94fb4226a 100644 --- a/Editor/Processors/TraceAndOptimize/ComponentDependencyCollector.cs +++ b/Editor/Processors/TraceAndOptimize/ComponentDependencyCollector.cs @@ -406,8 +406,17 @@ private static void InitByTypeParsers() AddParserWithExtends(); AddParser((collector, deps, component) => { - collector.GetDependencies(component.GetComponent()).AddActiveDependency(component); - deps.AddActiveDependency(component.connectedBody); + var rigidBody = component.GetComponent(); + if (rigidBody) + { + collector.GetDependencies(rigidBody).AddActiveDependency(component); + deps.AddActiveDependency(rigidBody); + } + if (component.connectedBody) + { + collector.GetDependencies(component.connectedBody).AddActiveDependency(component); + deps.AddActiveDependency(component.connectedBody); + } }); AddParserWithExtends(); AddParserWithExtends();