My player character spawning multiple colors waves and try to detect upcoming objects.
Here is the small snapshot of the overall idea:

I have spawned pink and blue color waves for testing purposes. I have used IEnumerator (Thread) to generate each color wave.
Now two enumerators/threads working separately and completed their job properly. I don’t have a problem with their work.
now I require some identifier or index to uniquely identify each running thread and how to manage this with c# that I don’t know!
So please guide me into this 
First, Unity coroutines are not separate threads.
Second, you can keep track of them by simply keeping a reference to the IEnumerator they return. Let’s say you have this coroutine:
IEnumerator MyCoroutine() {
// some code
yield return new WaitForSeconds(..whatever..);
// some more code
}
You can keep track of it like this:
IEnumerator coroutine = MyCoroutine();
// start it!
StartCoroutine(coroutine);
// stop it!
StopCoroutine(coroutine);
So if you had many of them you could keep a list:
List<IEnumerator> coroutines = new List<IEnumerator>();
foreach (var platform in platforms) {
var coroutine = MyCoroutine(/*maybe platform goes here*/);
coroutines.Add(coroutine);
StartCoroutine(coroutine);
}
1 Like
StartCoroutine also returns a ‘Coroutine’ object:
This object can also be used to stop the coroutine, or yielded to wait for its completion.
Basically I want identifier within the Coroutine to uniquely identify this Coroutine.
So I can manage my other parameters based on this unique value.
Both of the things we said are unique identifiers for a specifically running coroutine.
As for ‘So I can manage my other parameters based on this unique value.’ I’m not sure in what context you mean. You want an “index”, but an index to what? If you stick the ienumerator OR coroutine token into a list, they would be indexed. But that’s not necessary really…