Skip to content

Commit

Permalink
added ifdef for animationClip.SetCurve at runtime (only works with le…
Browse files Browse the repository at this point in the history
…gacy animations clips)
  • Loading branch information
pfcDorn committed Sep 28, 2023
1 parent 99a35dd commit 460edb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Runtime/Scripts/GLTFSceneImporter.cs
Expand Up @@ -37,7 +37,7 @@ public class ImportOptions
public IDataLoader DataLoader = null;
public AsyncCoroutineHelper AsyncCoroutineHelper = null;
public bool ThrowOnLowMemory = true;
public AnimationMethod AnimationMethod = AnimationMethod.Mecanim;
public AnimationMethod AnimationMethod = AnimationMethod.Legacy;
public bool AnimationLoopTime = true;
public bool AnimationLoopPose = false;

Expand Down
7 changes: 6 additions & 1 deletion Runtime/Scripts/SceneImporter/ImporterAnimation.cs
Expand Up @@ -161,7 +161,12 @@ protected virtual async Task BuildAnimationSamplers(GLTFAnimation animation, int

// copy all key frames data to animation curve and add it to the clip
AnimationCurve curve = new AnimationCurve(keyframes[ci]);
clip.SetCurve(relativePath, curveType, propertyNames[ci], curve);

#if !UNITY_EDITOR
// Only in editor SetCurve works with non-legacy clips
if (clip.legacy)
#endif
clip.SetCurve(relativePath, curveType, propertyNames[ci], curve);
}
}

Expand Down

0 comments on commit 460edb1

Please sign in to comment.