Hi. I need help . I get an error when I write these codes. Where do i make mistakes ? Thanks.
Error : CS1503 cannot convert from ‘UnityEngine.Vector3’ to 'UnityEngine.Transform
using UnityEngine;
using System.Collections;
public class SpawnArea : MonoBehaviour
{
public Transform prefab;
public float width = 3;
public float second = 1;
private bool create = true;
void Update()
{
if (create)
StartCoroutine(“CreatePrefab”);
}
IEnumerator CreatePrefab()
{
create = false;
width += width;
Instantiate(prefab, new Vector3(Random.Range(-2f,3f), 0, 0));
yield return new WaitForSeconds(second = Random.Range(1f, 5f));
create = true;
}
}