using System.Collections; using System.Collections.Generic; using UnityEngine; public class YuniManager : MonoBehaviour { public int numberOfYunis = 5; public GameObject yuniPrefab; private GameObject[] yunis; void Start() { yunis = new GameObject[numberOfYunis]; int middle = numberOfYunis / 2; for (int i = 0; i < numberOfYunis; i++) { Vector3 position = new Vector3((i - middle) * 1.5f, 0, 0); Quaternion rotation = Quaternion.identity; GameObject newlyCreated = Object.Instantiate(yuniPrefab, position, rotation); yunis[i] = newlyCreated; //newlyCreated.GetComponent().useGravity = false; } yunis[middle].GetComponent(). AddForce(100 * Vector3.right); } }