я хочу чтоб Random.Range принимал рандом по y
(1.84f, -2.69f)
это y
Instantiate(Enemy, new Vector2(Random.Range(-6.36f, (1.84f, -2.69f), Quaternion.identity);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemySpawner : MonoBehaviour
{
public GameObject Enemy;
// Start is called before the first frame update
void Start()
{
StartCoroutine(Spawn());
}
IEnumerator Spawn()
{
while (true)
{
Instantiate(Enemy, new Vector2(Random.Range(-6.36f, (1.84f, -2.69f), Quaternion.identity);
yield return new WaitForSeconds (Random.Range(4, 8));
}
}
// Update is called once per frame
void Update()
{
}
}