I wrote a Script which creates a array of gameobjects I added the rigidbody and boxcollider to the gameobjects.
I created an empty object and added the Script.
Unfortnetley the collison wont be detected.
If i add the Script e.g to my player then it works.
The code of the script of my gameobjects with the array:
for(int i= 0; i < rain.Length; i++){
rain[i] = GameObject.CreatePrimitive(PrimitiveType.Cube);
rain[i].name = "rain" + i;
rain[i].AddComponent<Rigidbody>();
rain[i].AddComponent<BoxCollider>();
rain[i].transform.localPosition = new Vector3(0,15, 0);
}
what i want to reach is. I have a floor which contains my character. As the (gameobjects) are falling and collide with the floor the should respawn....
but with the method onCollsionEnter(....); the method just refers to the empty object and not the individual gameobjects which I created.


