Search Unity

Collisions of child objects from a prefab

Discussion in 'Prefabs' started by Deleted User, Feb 17, 2019.

  1. Deleted User

    Deleted User

    Guest

    Hello,

    I'm new to Unity, so I have a problem and need some help.

    There is one prefab which contains three or more cubes (cube 1, cube 2, cube3, ...). I want to know when there is a collision and which of the cubes collieded. I tried to put the OnTriggerEnter fuction into every child (every cube) of the prefab, but the name of the object which collided was still the name of the prefab.
    How can I get the name of the cube (e.g. cube2) to do something with it? And how can I address this particular cube when i know the name (make it red or something to see it workes)?

    Thanks a lot for yout input and please be as simple as possible for a newbie.
    Feel free to ask if you have further questions to understand my problem.