Hello guys! I just need a simple delay and then do code after this delay.
private void MovePlayerToNode(GameObject node)
{
List<Node> pathToDestination = mapGen.GetGrid().GetShortestPath(currentNode.GetComponent<Node>(), node.GetComponent<Node>());
for (int i = 0; i < pathToDestination.Count; i++)
{
StartCoroutine(Wait(secondsToWaitBeforeMovingToNode));
SetPlayerPosition(pathToDestination*.gameObject);*
}
}
IEnumerator Wait(float wait)
{
Debug.Log(Time.time);
yield return new WaitForSeconds(wait);
Debug.Log(Time.time);
}
Using this method i dont have any delay. What am i doing wrong? Both debug.logs write time at the same moment.