Skip to content

Commit

Permalink
[unity] Fixed compile error on Unity 2017.1 introduced in last commit…
Browse files Browse the repository at this point in the history
…. See #1253.
  • Loading branch information
HaraldCsaszar committed Dec 20, 2024
1 parent 0371e4d commit 2864e32
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,11 @@ public static AnimationClip GetAnimationClip (UnityEngine.Object animationWindow
PropertyInfo selectionProperty = animEditorField.FieldType.GetProperty("selection", bindingFlagsInstance);
object animEditor = animEditorField.GetValue(animationWindow);
if (animEditor == null) return null;
object selection = selectionProperty.GetValue(animEditor);
object selection = selectionProperty.GetValue(animEditor, null);
if (selection == null) return null;

PropertyInfo animationClipProperty = selection.GetType().GetProperty("animationClip");
return animationClipProperty.GetValue(selection) as AnimationClip;
return animationClipProperty.GetValue(selection, null) as AnimationClip;
}

public static float GetAnimationTime (UnityEngine.Object animationWindow) {
Expand All @@ -619,13 +619,13 @@ public static float GetAnimationTime (UnityEngine.Object animationWindow) {
FieldInfo animEditorField = AnimationWindowType.GetField("m_AnimEditor", bindingFlagsInstance);
object animEditor = animEditorField.GetValue(animationWindow);

System.Type animEditorFieldType = animEditorField.FieldType;
System.Type animEditorFieldType = animEditorField.FieldType;
PropertyInfo stateProperty = animEditorFieldType.GetProperty("state", bindingFlagsInstance);
System.Type animWindowStateType = stateProperty.PropertyType;
PropertyInfo timeProperty = animWindowStateType.GetProperty("currentTime", bindingFlagsInstance);

object state = stateProperty.GetValue(animEditor);
return (float)timeProperty.GetValue(state);
object state = stateProperty.GetValue(animEditor, null);
return (float)timeProperty.GetValue(state, null);
}
}
}

0 comments on commit 2864e32

Please sign in to comment.