Hi Esoteric Team,
I am trying to set an animation to a higher track (Track 1) so that my players gun firing animation takes over for the arms during a run animation on track 0. The problem is that when I type
if (skeletonAnimation.state.GetCurrent(1).ToString() != "Running_While_Outside_Pistol_Shooting_Up_And_Right_135")
{
var trackEntry = state.SetAnimation(1, _runningWhileOutsidePistolShootingUpAndRight135, false);
trackEntry.MixDuration = 0.1f;
}
I get an error from this line (if (skeletonAnimation.state.GetCurrent(1).ToString() != "Running_While_Outside_Pistol_Shooting_Up_And_Right_135")) stating that the object reference is not set to an instance of an object.
I never set Track 1 to anything so obviously it is null when it is starting to read if it is any other animation. How should I go about tackling this?
This is literally what I am trying to achieve lol.
"Tracks have many uses. For example, an animation that does not key everything can be played on a higher track, overriding the lower track only for what is keyed. Track 0 could have a walk, run, swim, or other animation and track one could have a shoot animation that keys only the arm and gun firing. Also, setting the TrackEntry alpha for a higher track allows it to mix with the tracks below it. For example, track 0 could have a walk animation and track 1 could have a limp animation. The alpha for track 1 is increased as the player takes damage, so they limp more and more."
Tim