I created 10ea Clone Objects by using “Instantiate”. These are being moved by the Flocking Algorithm.
I touch the screen to shoot the RayCast laser, and I am trying to find out what index the Clone Object hit by the laser is.
The Clone Object of the corresponding index will deviate from the Flocking Algorithm and implement to approach me.
Please provide a good idea for how to get the index returned
Not possible. There is no way for an object to know it is referenced from some other object. You have to store any such “back references” manually.
What you can do is create a script on each instantiated object and store its index in a public variable there when you instantiate it. (I assume you are instantiating from a prefab, and perhaps there is already a script on the object you can use.) Then, when you get a hit from your raycast, you can inspect the value of that variable. This is a common thing to do.