I m using this piece of code in C#
for(int i = 0; i < 10; i++)
{
//I want some delay here
coinPicked.transform.position = new Vector3(coinPicked.transform.position.x, coinPicked.transform.position.y + 0.0001f, coinPicked.transform.position.z);
}
can anybody help me?
DannyB
2
You may want to check WaitForSeconds
You will need to:
- Put your code above in an IEnumerator typed function
- Call yield return new WaitForSeconds( numberOfSeconds ) wherever you want the delay
- Call the IEnumerator using StartCoroutine( functionName )
Some examples in this answer and in this manual page.