diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/RootMotion/SkeletonRootMotionBase.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/RootMotion/SkeletonRootMotionBase.cs
index c4fb7039b..a85b077ba 100644
--- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/RootMotion/SkeletonRootMotionBase.cs
+++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/RootMotion/SkeletonRootMotionBase.cs
@@ -213,7 +213,7 @@ namespace Spine.Unity {
Vector2 parentBoneScale;
GetScaleAffectingRootMotion(out parentBoneScale);
ClearEffectiveBoneOffsets(parentBoneScale);
- skeletonComponent.Skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
+ skeletonComponent.Skeleton.UpdateWorldTransform(Skeleton.Physics.Pose);
}
ClearRigidbodyTempMovement();
diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs
index 032dd46f4..ed1c6a4dd 100644
--- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs
+++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs
@@ -83,10 +83,15 @@ namespace Spine.Unity {
///
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
- ///
+ ///
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
/// Using this callback will cause the world space values to be solved an extra time.
- /// Use this callback if want to use bone world space values, and also set bone local values.
+ /// Use this callback if want to use bone world space values, and also set bone local values.
+ ///
+ /// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting
+ /// and to save updates by setting one to
+ /// .
+ ///
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
///
@@ -104,6 +109,15 @@ namespace Spine.Unity {
/// Instance SkeletonAnimation.timeScale will still be applied.
[SerializeField] protected bool unscaledTime;
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
+
+ protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
+ protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
+ /// Physics update mode used in the main call to skeleton.UpdateWorldTransform().
+ public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
+ /// Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
+ /// such as after the callback if a method is subscribed at the UpdateWorld delegate.
+ ///
+ public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
#endregion
#region Serialized state and Beginner API
@@ -264,11 +278,11 @@ namespace Spine.Unity {
if (_UpdateLocal != null)
_UpdateLocal(this);
- UpdateWorldTransform();
+ UpdateWorldTransform(mainPhysicsUpdate);
if (_UpdateWorld != null) {
_UpdateWorld(this);
- UpdateWorldTransform();
+ UpdateWorldTransform(additionalPhysicsUpdate);
}
if (_UpdateComplete != null) {
diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs
index 643fbf179..828e13ed5 100644
--- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs
+++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs
@@ -403,19 +403,19 @@ namespace Spine.Unity {
if (UpdateLocal != null)
UpdateLocal(this);
- UpdateWorldTransform();
+ UpdateWorldTransform(mainPhysicsUpdate);
if (UpdateWorld != null) {
UpdateWorld(this);
- UpdateWorldTransform();
+ UpdateWorldTransform(additionalPhysicsUpdate);
}
if (UpdateComplete != null)
UpdateComplete(this);
}
- protected void UpdateWorldTransform () {
- skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
+ protected void UpdateWorldTransform (Skeleton.Physics physics) {
+ skeleton.UpdateWorldTransform(physics);
}
public void LateUpdate () {
@@ -644,6 +644,15 @@ namespace Spine.Unity {
[SerializeField] protected bool unscaledTime;
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
+ protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
+ protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
+ /// Physics update mode used in the main call to skeleton.UpdateWorldTransform().
+ public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
+ /// Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
+ /// such as after the callback if a method is subscribed at the UpdateWorld delegate.
+ ///
+ public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
+
/// Occurs after the vertex data populated every frame, before the vertices are pushed into the mesh.
public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices;
diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs
index ef193c2a9..5a2d35f88 100644
--- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs
+++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs
@@ -63,10 +63,15 @@ namespace Spine.Unity {
/// Use this callback when you want to set bone local values.
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
- ///
+ ///
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
/// Using this callback will cause the world space values to be solved an extra time.
- /// Use this callback if want to use bone world space values, and also set bone local values.
+ /// Use this callback if want to use bone world space values, and also set bone local values.
+ ///
+ /// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting
+ /// and to save updates by setting one to
+ /// .
+ ///
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
///
@@ -77,6 +82,15 @@ namespace Spine.Unity {
[SerializeField] protected UpdateTiming updateTiming = UpdateTiming.InUpdate;
public UpdateTiming UpdateTiming { get { return updateTiming; } set { updateTiming = value; } }
+
+ protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
+ protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
+ /// Physics update mode used in the main call to skeleton.UpdateWorldTransform().
+ public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
+ /// Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
+ /// such as after the callback if a method is subscribed at the UpdateWorld delegate.
+ ///
+ public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
#endregion
public override void Initialize (bool overwrite, bool quiet = false) {
@@ -156,11 +170,11 @@ namespace Spine.Unity {
if (_UpdateLocal != null)
_UpdateLocal(this);
- UpdateWorldTransform();
+ UpdateWorldTransform(mainPhysicsUpdate);
if (_UpdateWorld != null) {
_UpdateWorld(this);
- UpdateWorldTransform();
+ UpdateWorldTransform(additionalPhysicsUpdate);
}
if (_UpdateComplete != null)
diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs
index b2c2123cc..b2dcf7c1c 100644
--- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs
+++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs
@@ -423,7 +423,7 @@ namespace Spine.Unity {
// Generate mesh once, required to update mesh bounds for visibility
UpdateMode updateModeSaved = updateMode;
updateMode = UpdateMode.FullUpdate;
- UpdateWorldTransform();
+ UpdateWorldTransform(Skeleton.Physics.Update);
LateUpdate();
updateMode = updateModeSaved;
@@ -439,8 +439,8 @@ namespace Spine.Unity {
#endif
}
- protected virtual void UpdateWorldTransform () {
- skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
+ protected virtual void UpdateWorldTransform (Skeleton.Physics physics) {
+ skeleton.UpdateWorldTransform(physics);
}
///
diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs
index 06dea7f70..67871d778 100644
--- a/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs
+++ b/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs
@@ -63,6 +63,8 @@ namespace Spine.Unity {
event UpdateBonesDelegate UpdateComplete;
Skeleton Skeleton { get; }
UpdateTiming UpdateTiming { get; set; }
+ Skeleton.Physics MainPhysicsUpdate { get; set; }
+ Skeleton.Physics AdditionalPhysicsUpdate { get; set; }
}
/// Holds a reference to a SkeletonDataAsset.
diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json
index 009ffc207..2e975374b 100644
--- a/spine-unity/Assets/Spine/package.json
+++ b/spine-unity/Assets/Spine/package.json
@@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core.",
- "version": "4.2.35",
+ "version": "4.2.36",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",