Unity animations using code only without animator

Hi, just a quick question, in unity is there a way to activate a certain animation file without using the animator, for example: When player presses space active this jump animation if he releases space activate this falling animation (Only using code).

Hi, @Younis4x . You Had A Animation? Ok, Let Me Show You, How To Make Unity Animations Only Using Code And Withou Using Animator, With By Step By Step Version. Step One: Create a GameObject On Hierarchy Tab. Step Two: Add Your Animation, Animator And Create A Script On Created GameObject.
Step Three: Open The Created Script And Code The Script This Code:

Using System.Collections;
Using System.Collections.Generic;
Using UnityEngine;

public class LifeTime : MonoBehaviour
        public float lifeTime = 0.3f;

        void Start()
               Destroy(gameObject, lifeTime);



Step Four: Go To The Player or Tnt GameObject And Open Player or Bomb Script. Step Five: First Add This Code On Public Area:

public GameObject jumpPrefab;

or This:

public GameObject explosionPrefab;

Step Six: Add This Code On İf(Input.GetKeyDown(KeyCode.Space)) Area Or Explosion void this Script:

Instantiate(explosionPrefab, transform.position, transform.rotation);

or This Code:

Instantiate(jumpPrefab, transform.position, transform.rotation);

But First On Explosion İn 2D, Explosion Area Type This On void Update():



That’s All For Me. İf Doesn’t Work, Go This Question To Comment Me. İf You Don’t Understand, Here’s Video Version: 1

Thank you for the detailed answer i really appreciate it!