- Home /
Reading anim files at runtime
I'm loading anim files from a file at runtime and would like to execute them. As far as i can see there isn't really any other way than reading the .anim file myself. I was wondering if there's any documentation on the .anim fileformat.
By analyzing a testanimation, it looks like m_EditorCurves
is the way to go. But I'm not sure if it's included in every file. Especially since there's also m_PositionCurves
, m_EulerCurves
, m_ScaleCurves
, m_FloatCurves
and m_PPtrCurves
. Which might be a better idea since EditorCurves seem to be how Unity maps the curves to the UI. But using editorcurves would be a lot simpler to animate since i can simply plug in the attribute
, path
and values into a animationclip and play that.
Sample of the editorcurves from the testanimation:
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
time: 0
value: -0
inSlope: 0
outSlope: 0
tangentMode: 136
- serializedVersion: 2
time: 0.35
value: 50
inSlope: 0
outSlope: 0
tangentMode: 136
- serializedVersion: 2
time: 0.5833333
value: 50
inSlope: 0
outSlope: 0
tangentMode: 136
- serializedVersion: 2
time: 1
value: -0
inSlope: 0
outSlope: 0
tangentMode: 136
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.x
path: Cylinder003
classID: 4
script: {fileID: 0}
Any information or links about the file format or alternatives would be helpfull.