[unity] PhysicsConstraints: Fixed a potential bug with last position and rotation being reset too early in Initialize().

This commit is contained in:
Harald Csaszar 2024-01-26 18:04:42 +01:00
parent e65f3f61a5
commit b5f6e8066f
2 changed files with 4 additions and 4 deletions

View File

@ -711,8 +711,6 @@ namespace Spine.Unity {
}
public void Initialize (bool overwrite) {
ResetLastPositionAndRotation();
if (this.IsValid && !overwrite) return;
#if UNITY_EDITOR
if (BuildUtilities.IsInSkeletonAssetBuildPreProcessing)
@ -733,6 +731,8 @@ namespace Spine.Unity {
baseTexture = skeletonDataAsset.atlasAssets[0].PrimaryMaterial.mainTexture;
canvasRenderer.SetTexture(this.mainTexture); // Needed for overwriting initializations.
ResetLastPositionAndRotation();
// Set the initial Skin and Animation
if (!string.IsNullOrEmpty(initialSkinName))
skeleton.SetSkin(initialSkinName);

View File

@ -396,8 +396,6 @@ namespace Spine.Unity {
/// Initialize this component. Attempts to load the SkeletonData and creates the internal Skeleton object and buffers.</summary>
/// <param name="overwrite">If set to <c>true</c>, it will overwrite internal objects if they were already generated. Otherwise, the initialized component will ignore subsequent calls to initialize.</param>
public virtual void Initialize (bool overwrite, bool quiet = false) {
ResetLastPositionAndRotation();
if (valid && !overwrite)
return;
#if UNITY_EDITOR
@ -434,6 +432,8 @@ namespace Spine.Unity {
ScaleY = initialFlipY ? -1 : 1
};
ResetLastPositionAndRotation();
if (!string.IsNullOrEmpty(initialSkinName) && !string.Equals(initialSkinName, "default", System.StringComparison.Ordinal))
skeleton.SetSkin(initialSkinName);