When I animate my reload animation, it stays on the last frame, is there a setting or code that can make it return to the original position after the Animation is complete?
At the bottom of the Animation window, there are different options for animations like Default, Loop etc. Or if it is an imported animation, you can find Wrap Mode in Import Settings/Animation. One of them (I guess “Once” option) would help.
You can use the ‘Rewind’ command in code.
Look it up in the Help menu/Script Reference and search for rewind.
Snippet of code to show it in use.
if (inRange && !Activated && Input.GetKeyDown(KeyCode.E))
{
if (!buttonPushAnim.isPlaying || buttonPushAnim["NNLiftButton"].time == 0)
{
buttonPushAnim.Rewind();
buttonPushAnim["NNLiftButton"].speed = 1.0f;
buttonPushAnim.Play();