Skip to content

Commit f6282d7

Browse files
author
Unity Technologies
committed
com.unity.physics@1.4.3
## [1.4.3] - 2025-10-17 ### Added * The Force Unique Collider companion component can now be disabled in the Inspector. When disabled it will no longer cause its associated baked Unity Physics Colliders to be unique. ### Changed * Updated the Burst dependency to version 1.8.25 ### Deprecated ### Removed ### Fixed * Baked Unity Physics Colliders that are forced to be unique will now produce stable collider blob hashes. This ensures that associated artifact IDs in your project will no longer change each time the project is re-imported. Note that baked colliders can be forced to be unique either via the "Force Unique" option in the custom Physics Shape authoring component, or via the Force Unique Collider companion component for built-in Colliders. Both approaches now support stable collider blob hashes. ### Security
1 parent 2a7a129 commit f6282d7

File tree

24 files changed

+533
-58
lines changed

24 files changed

+533
-58
lines changed

.attestation.p7m

1 Byte
Binary file not shown.

.signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":1759420299,"signature":"av9aJH2yh9avsNL71KJXu8w5CeNLQ4hCfJyW5TcSErto8B1Q/Z8bm7f7c64Hk+B9c+rCtE9LW6Tx7R20QH+a4b2QBOR2438pGaMPQMovvnHOpzMZNHkYqMS5Fx7Oz7jrHFHQHU8fFDK8TYl4P30wxBQ9DHpGNla0a0QC+YBVPen1UmYaNrqdrcDzKiArElHsBY8fxGAB6PWV89MFG/AxB6TTCeuaXx2F5fQYLTM53Q6eKadHsExFlKjje4zygJWaQKmlWj2ZtuBdQnv6V6HUN/Ser9CkJcAyrfWCpAHjdHJvWuaJSEm/EQz3XFK2aQoJLl46BI0bldzQ1HNRr678GTSnMgaSrAtyG9ExKZeY8j9e1/OPn/KY9xyP0alZhdU4miW1hBeqTqG1fQL7umXN1+GRHP3xp/oJAR5GfHOkAskwP9F1eeASqGEZ2DKOFELL1tuXWwG6Vf6pk1qg4kgm43Y88OSuYePhmP4MA1wODbym9f0/wxHEh47mOqoDrv3d","publicKey":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQm9qQU5CZ2tx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gUFVCTElDIEtFWS0tLS0tCg"}

ApiUpdater~/ValidationWhiteList.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ uid: unity-physics-changelog
44

55
# Changelog
66

7+
## [1.4.3] - 2025-10-17
8+
9+
### Added
10+
11+
* The Force Unique Collider companion component can now be disabled in the Inspector. When disabled it will no longer cause its associated baked Unity Physics Colliders to be unique.
12+
13+
### Changed
14+
15+
* Updated the Burst dependency to version 1.8.25
16+
17+
### Deprecated
18+
19+
20+
### Removed
21+
22+
23+
### Fixed
24+
25+
* Baked Unity Physics Colliders that are forced to be unique will now produce stable collider blob hashes. This ensures that associated artifact IDs in your project will no longer change each time the project is re-imported. Note that baked colliders can be forced to be unique either via the "Force Unique" option in the custom Physics Shape authoring component, or via the Force Unique Collider companion component for built-in Colliders. Both approaches now support stable collider blob hashes.
26+
27+
### Security
28+
29+
730
## [1.4.2] - 2025-09-05
831

932
### Added
@@ -43,6 +66,7 @@ uid: unity-physics-changelog
4366
### Security
4467

4568

69+
4670
## [1.4.0-pre.3] - 2025-06-06
4771

4872

Documentation~/component-step.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ This component allows configuring various aspects of the simulation via the foll
1212
| Solver Iteration Count | Specify the number of solver iterations the physics system performs to correct contact penetrations and joint errors. Higher values provide higher accuracy and stability, but can reduce simulation performance. |
1313
| Multi Threaded | Enable multi-threading.<br>If enabled, the physics system maximizes the number of threads used for calculating the simulation results. If disabled, the physics system reduces the number of utilized threads to a minimum, performing most operations in a single thread. |
1414
| Collision Tolerance | Set the collision tolerance.<br> The collision tolerance specifies the minimum distance required for contacts between rigid bodies to be created. This value can be increased if undesired collision tunneling is observed in the simulation. |
15+
| Max Dynamic Depenetration Velocity | Set the maximum relative velocity that can be produced when separating intersecting dynamic rigid bodies. This can be useful in cases where contacts lead to deep intersections between colliders, consequently causing too aggressive, ejecting motions. |
16+
| Max Static Depenetration Velocity | Set the maximum relative velocity that can be produced when separating dynamic rigid bodies intersecting with static rigid bodies. This can be useful in cases where contacts lead to deep intersections between colliders, consequently causing too aggressive, ejecting motions. |
1517
| Incremental Dynamic Broadphase | Enable the incremental dynamic broadphase.<br>Enabling this option will update the dynamic broadphase incrementally whenever changes between simulation steps occur, potentially leading to time savings for cases with many dynamic rigid bodies that don't move or otherwise change. |
1618
| Incremental Static Broadphase | Enable the incremental static broadphase.<br> Enabling this option will update the static broadphase incrementally whenever changes between simulation steps occur, potentially leading to time savings for cases with many static rigid bodies that don't move or otherwise change. |
1719
| Synchronize Collision World | Specify whether to update the collision world after the step for more precise raycast, collider and distance query results. |
18-
| Enable Contact Solver Stabilization Heuristic | Enabling the contact solver stabilization heuristic results in better simulation stability when stacking objects with low solver iteration counts, by preventing undesired sliding artifacts. However, it can reduce simulation performance and produce unplausible results in certain physical interactions involving friction forces. |
20+
| Enable Contact Solver Stabilization Heuristic | Enabling the contact solver stabilization heuristic results in better simulation stability when stacking objects with low solver iteration counts, by preventing undesired sliding artifacts. However, it can reduce simulation performance and produce unplausible results in certain physical interactions involving friction forces. |
1921

2022
![collider_cast](images/physics-step.png)<br/>_The Physics Step authoring component provides access to various simulation configuration settings._
2.24 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using UnityEditor;
2+
3+
#if UNITY_EDITOR
4+
5+
namespace Unity.Physics.Editor
6+
{
7+
static class CustomComponentVersionUpgrader
8+
{
9+
[MenuItem("Tools/Unity Physics/Upgrade Physics Shape Versions")]
10+
static void UpgradeAssetsWithPhysicsShape()
11+
{
12+
ComponentVersionUpgrader.UpgradeAssets<Authoring.PhysicsShapeAuthoring>("Physics Shape");
13+
}
14+
}
15+
}
16+
17+
#endif

Samples~/CustomPhysicsAuthoring/Unity.Physics.Custom.Editor/EditorTools/CustomComponentVersionUpgrader.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Samples~/CustomPhysicsAuthoring/Unity.Physics.Custom/Bodies/BakingSystems/PhysicsShapeBakingSystem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ShapeComputationDataBaking GetInputDataFromAuthoringComponent(PhysicsShapeAuthor
8181
};
8282

8383
ForceUniqueColliderAuthoring forceUniqueComponent = body.GetComponent<ForceUniqueColliderAuthoring>();
84-
bool isForceUniqueComponentPresent = forceUniqueComponent != null;
84+
bool isForceUniqueComponentPresent = forceUniqueComponent != null && forceUniqueComponent.enabled;
8585

8686
var data = GenerateComputationData(shape, bodyTransform, instance, colliderEntity, isForceUniqueComponentPresent);
8787

@@ -261,7 +261,7 @@ private ShapeComputationDataBaking GenerateComputationData(PhysicsShapeAuthoring
261261
Instance = colliderInstance,
262262
Material = ProduceMaterial(shape),
263263
CollisionFilter = ProduceCollisionFilter(shape),
264-
ForceUniqueIdentifier = isUnique ? (uint)shape.GetInstanceID() : 0u
264+
ForceUniqueIdentifier = isUnique ? shape.ForceUniqueID : 0u
265265
};
266266

267267
var shapeTransform = shape.transform;

Samples~/CustomPhysicsAuthoring/Unity.Physics.Custom/Bodies/PhysicsShapeAuthoring.cs

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.ComponentModel;
43
using System.Diagnostics;
54
using Unity.Burst;
65
using Unity.Collections;
@@ -10,6 +9,10 @@
109
using UnityEngine;
1110
using UnityEngine.Rendering;
1211

12+
#if UNITY_EDITOR
13+
using UnityEditor;
14+
#endif
15+
1316
namespace Unity.Physics.Authoring
1417
{
1518
public sealed class UnimplementedShapeException : NotImplementedException
@@ -22,12 +25,16 @@ public UnimplementedShapeException(ShapeType shapeType)
2225
[Icon(k_IconPath)]
2326
#endif
2427
[AddComponentMenu("Entities/Physics/Physics Shape")]
25-
public sealed class PhysicsShapeAuthoring : MonoBehaviour, IInheritPhysicsMaterialProperties, ISerializationCallbackReceiver
28+
public sealed class PhysicsShapeAuthoring : MonoBehaviour, IInheritPhysicsMaterialProperties
2629
{
2730
const string k_IconPath = "Packages/com.unity.physics/Unity.Physics.Editor/Editor Default Resources/Icons/d_BoxCollider@64.png";
2831

2932
PhysicsShapeAuthoring() {}
3033

34+
internal uint ForceUniqueID => m_ForceUniqueID;
35+
[SerializeField]
36+
uint m_ForceUniqueID = 0;
37+
3138
[Serializable]
3239
struct CylindricalProperties
3340
{
@@ -734,28 +741,50 @@ void OnEnable()
734741
// included so tick box appears in Editor
735742
}
736743

737-
const int k_LatestVersion = 1;
738-
739-
[SerializeField]
740-
int m_SerializedVersion = 0;
744+
const int k_VersionAddedForceUniqueID = 2; // added ForceUniqueID for stable artifact IDs
745+
const int k_LatestVersion = k_VersionAddedForceUniqueID;
741746

742-
void ISerializationCallbackReceiver.OnBeforeSerialize() {}
747+
[SerializeField, HideInInspector]
748+
int m_SerializedVersion = k_LatestVersion;
743749

744-
void ISerializationCallbackReceiver.OnAfterDeserialize() => UpgradeVersionIfNecessary();
750+
#if UNITY_EDITOR
751+
static string s_LastWarnedPath;
752+
static double s_NextWarningTime;
753+
#endif
745754

746-
#pragma warning disable 618
747755
void UpgradeVersionIfNecessary()
748756
{
749757
if (m_SerializedVersion < k_LatestVersion)
750758
{
751-
// old data from version < 1 have been removed
752-
if (m_SerializedVersion < 1)
753-
m_SerializedVersion = 1;
759+
m_SerializedVersion = k_LatestVersion;
760+
761+
#if UNITY_EDITOR
762+
if (PrefabUtility.IsPartOfAnyPrefab(this) || gameObject.scene.IsValid())
763+
{
764+
// Inform user that scene needs to be saved:
765+
766+
var scenePath = gameObject.scene.path;
767+
768+
if (string.IsNullOrEmpty(scenePath))
769+
{
770+
var gameObjectPath = UnityEditor.Search.SearchUtils.GetHierarchyPath(gameObject);
771+
UnityEngine.Debug.LogWarning("A Physics Shape component in game object '" + gameObjectPath + "' needs to be upgraded. "
772+
+ "To apply the upgrade, open and re-save the containing asset, " +
773+
"or use the automatic version upgrade tool under 'Tools -> Unity Physics -> Upgrade Physics Shape Versions'.", gameObject);
774+
}
775+
else if (scenePath != s_LastWarnedPath || EditorApplication.timeSinceStartup > s_NextWarningTime)
776+
{
777+
UnityEngine.Debug.LogWarning("A Physics Shape component in a scene needs to be upgraded. To apply the upgrade, open and re-save the scene '" + scenePath + "', " +
778+
"or use the automatic version upgrade tool under 'Tools -> Unity Physics -> Upgrade Physics Shape Versions'.");
779+
780+
s_LastWarnedPath = scenePath;
781+
s_NextWarningTime = EditorApplication.timeSinceStartup + 5f;
782+
}
783+
}
784+
#endif
754785
}
755786
}
756787

757-
#pragma warning restore 618
758-
759788
static void Validate(ref CylindricalProperties props)
760789
{
761790
props.Height = math.max(0f, props.Height);
@@ -764,7 +793,10 @@ static void Validate(ref CylindricalProperties props)
764793

765794
void OnValidate()
766795
{
767-
UpgradeVersionIfNecessary();
796+
if (m_ForceUniqueID == 0)
797+
{
798+
m_ForceUniqueID = (uint)UnityEngine.Random.Range(1, Int32.MaxValue);
799+
}
768800

769801
m_PrimitiveSize = math.max(m_PrimitiveSize, new float3());
770802
Validate(ref m_Capsule);
@@ -801,6 +833,8 @@ void OnValidate()
801833
m_ConvexHullGenerationParameters.OnValidate();
802834

803835
PhysicsMaterialProperties.OnValidate(ref m_Material, true);
836+
837+
UpgradeVersionIfNecessary();
804838
}
805839

806840
// matrix to transform point from shape space into world space

0 commit comments

Comments
 (0)