Top.Mail.Ru
Ответы

Помогите! Ошибка CS1503 Аргумент 1: не удается преобразовать из "System.Collections.IEnumerable" в "string".

Вот код:

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

public class GenerateEnemy : MonoBehaviour
{
public Transform[] points;
public GameObject factory;

private void Start()
{
StartCoroutine(SpawnFactory());
}

IEnumerable SpawnFactory()
{
for (int i = 0; i < points.Length; i++)
{
yield return new WaitForSeconds(10f);
GameObject spawn = Instantiate(factory);
Destroy(spawn.GetComponent<PlaceObjects>());
spawn.transform.position = points[i].position;
spawn.transform.rotation = Quaternion.Euler(new Vector3(0, UnityEngine.Random.Range(0, 360), 0));
spawn.GetComponent<AutoCarCreate>().enabled = true;
}
}

}

По дате
По рейтингу
Аватар пользователя
Просветленный

Попробуйте так

1234
     private void Start() 
    { 
        StartCoroutine("SpawnFactory"); 
    }