Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GameObject from Transform

Discussion in 'Scripting' started by Richard_B, Aug 19, 2005.

  1. Richard_B

    Richard_B

    Joined:
    Jul 22, 2005
    Posts:
    436
    If I have the "transform" of an object (which I have got from transform.parent), how do I get (in js) the GameObject for which the transform is a component?

    thanks,
    Richard.

    PS I am trying to automate the "getting" of the parent - I am trying to avoid the "drag the parent on to the public variable" way of doing it.
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    transform.parent.gameObject
     
  3. Richard_B

    Richard_B

    Joined:
    Jul 22, 2005
    Posts:
    436
    thanks - doh!

    Richard.