File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
sources/engine/Stride.Physics Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ public override ColliderShape ColliderShape
119
119
120
120
if ( InternalRigidBody == null )
121
121
{
122
- if ( ! attachInProgress )
122
+ if ( Data != null && ! attachInProgress )
123
123
{
124
124
//When setting ColliderShape, setup could have been previously skipped (eg when PhysicsComponent is created using GetOrCreate)
125
125
ReAttach ( ) ;
Original file line number Diff line number Diff line change @@ -698,6 +698,10 @@ internal void Attach(PhysicsProcessor.AssociatedData data)
698
698
/// </summary>
699
699
internal void ReAttach ( )
700
700
{
701
+ if ( Data == null )
702
+ {
703
+ throw new InvalidOperationException ( "PhysicsComponent has not been attached yet." ) ;
704
+ }
701
705
//TODO: Could consider fully detaching and then rebuilding, but ideally this would cause null refs on Rigidbody OnDetach calls
702
706
//Shouldnt call detach, because at this point the user has added new components and this runs as a check to rebuild as needed.
703
707
//Entire wipes to rebuild causes loss in the data that the user has just added (and is slower)
You can’t perform that action at this time.
0 commit comments