Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Translate another GameObject

Discussion in '2D' started by Bohemond, Jul 28, 2017.

  1. Bohemond

    Bohemond

    Joined:
    Jul 28, 2017
    Posts:
    4
    Hi ! ^^

    I am new on Unity and I am french so i beg your pardon for my easy question or english mistakes ;)

    So, this is my question :

    I have found how to translate a game object with the command "transform.Translate" but I want to translate another gameObject which is not attached to the script which contains the translate command.

    For example, when the mouse is over the gameObject n°1 which is attached to the script, I want gameObject n°2 translates.

    A great thank to persons who will take a little of their time to answer me ^^
     
  2. guillermoi

    guillermoi

    Joined:
    Sep 20, 2012
    Posts:
    27
  3. Bohemond

    Bohemond

    Joined:
    Jul 28, 2017
    Posts:
    4
    Yes, i am using OnMouseOver ^^

    Yes, it works perfectly ! ^^
    It looks like so simple when we understand how it works ^^

    Great thanks guillermoi ! :)