I’m trying to instantiate one prefab several times with a List which contains the positions. This should be done one by one, that means, one appears, wait 1 second, other appears, wait one second and so on.
For that purpose I created the next method which is called from Awake()
async void CreateMap(List<Vector3> dist)
{
foreach(Vector3 d in dist)
{
Instantiate(Casilla, Vector3.Scale(d,coords), orientation);
await Task.Delay(1000);
}
}
The problem is: Some of them appear at the same time and others appear individually. So I’m kind of confused. Should I use other kind of delay? Is asynchronous Task.Delay working well when being called from Awake()?
Thank you!