Search Unity

Object Name Detection and Sharing

Discussion in 'Scripting' started by Genrcade, Feb 13, 2016.

  1. Genrcade

    Genrcade

    Joined:
    Jan 23, 2016
    Posts:
    3
    Hi,

    Here’s my situation. I have 3 objects in my scene :

    Object 1 – named « Rectangle »
    Is fixed
    Has a collider
    Has a script​

    Object 2 – named « Sphere1 »
    Is moving
    Has a collider​

    Object 3 – named « Cone »
    Has a script​


    What I would like to do is :

    1) When "Sphere1" collids with "Rectangle", I would like to detect its name in the script of "Rectangle"

    2) Pass this information to the script of the object "Cone"

    3) Have the object "Cone" snapping to the position of "Sphere1" and following it

    Any help is more than welcomed.
    Thanks!