Skip to content

Commit

Permalink
Merge pull request #683 from anatawa12/joint-disappear
Browse files Browse the repository at this point in the history
fix: Joint can be disappeared unexpectedly
  • Loading branch information
anatawa12 authored Nov 4, 2023
2 parents 99d0a4f + c0e7c01 commit 39563ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- RigidBody Joint can be broken `#683`

### Security

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- RigidBody Joint can be broken `#683`

### Security

Expand Down
13 changes: 11 additions & 2 deletions Editor/Processors/TraceAndOptimize/ComponentDependencyCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,17 @@ private static void InitByTypeParsers()
AddParserWithExtends<Collider, WheelCollider>();
AddParser<Joint>((collector, deps, component) =>
{
collector.GetDependencies(component.GetComponent<Rigidbody>()).AddActiveDependency(component);
deps.AddActiveDependency(component.connectedBody);
var rigidBody = component.GetComponent<Rigidbody>();
if (rigidBody)
{
collector.GetDependencies(rigidBody).AddActiveDependency(component);
deps.AddActiveDependency(rigidBody);
}
if (component.connectedBody)
{
collector.GetDependencies(component.connectedBody).AddActiveDependency(component);
deps.AddActiveDependency(component.connectedBody);
}
});
AddParserWithExtends<Joint, CharacterJoint>();
AddParserWithExtends<Joint, ConfigurableJoint>();
Expand Down

0 comments on commit 39563ab

Please sign in to comment.