I am not sure why this wont work but, say if I dont want to have my functions all IEnumerators, could I instead have a function what manages yields? It doesnt work when I call it for some reason.
void Awake()
{
StartCoroutine("fakeYield", 0);
}
and this is the function :
IEnumerator fakeYield(float duration)
{
Debug.Log("Waiting for "+duration);
yield return new WaitForSeconds(duration);
}
and I am calling it like this :
void reArrangeChunkOrderToMatchSystem(int dir)
{
GameObject[] newData;
if (dir != 6)
{
switch (dir)
{
case 0:
newData = new GameObject[loadedChunkRadius * worldChunkDefaultLoadedHeight];
for (int i = 0; i < loadedChunkRadius * worldChunkDefaultLoadedHeight; i++)
{
newData *= ChunkInstance;*
}
int temp = 0;
for (int i = 0; i < loadedChunkRadius * worldChunkDefaultLoadedHeight * loadedChunkRadius; i++)
{
Vector3 a = loadedChunks*.transform.position;*
if (a.x == centerChunk.pos.x - 96)
{
fakeYield(0.1f);
loadedChunks_.transform.position += new Vector3(16 * (loadedChunkRadius - 1), 0, 0);
Vector3 vec = new Vector3(loadedChunks.GetComponent().chunk.pos.x, loadedChunks.GetComponent().chunk.pos.y, loadedChunks*.GetComponent().chunk.pos.z);_
_reloadChunkDataOrGenerateNew(vec, loadedChunks);
temp++;
}*_
}
break;
It debugs it once, during the awake function for some reason and whenever the loop calls it, it doesn’t call the function for some reason…