How to create multiple instance of character at runtime all having same walking and idle motion with their own position read from C# script in Unity?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ybotSpawn : MonoBehaviour
{

public GameObject GO_ybot;

public Transform prefab;
void Start()
{
    for (int i = 0; i < 10; i++)
    {
        InstantiateYbot(i);
    }
}

void InstantiateYbot(int i)
{
    GameObject GO_Current = (GameObject)Instantiate(GO_ybot);
    Instantiate(GO_Current, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);

}

// Update is called once per frame
void Update()
{
    
}

}

@joker_yash96 The actual walking animation only works on one of the instance but not on others. The other instance just translate and rotate.

Replace your code by this:

     void InstantiateYbot(int i)
     {
         GameObject GO_Current = (GameObject)Instantiate(GO_ybot,new Vector3(i * 2.0F, 0, 0), 
         Quaternion.identity);
       
     }

No need for double instantiation functions.