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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question GameObject - Components relationship.

Discussion in 'Scripting' started by psykick1, Jun 21, 2020.

  1. psykick1

    psykick1

    Joined:
    May 19, 2020
    Posts:
    61
    Hello,

    I know that Components is attached to the GameObject.
    But wondering how.

    GameObject is a container?
    Component and GameObject is nested Class?

    Thank you.
     
  2. raarc

    raarc

    Joined:
    Jun 15, 2020
    Posts:
    535
    component is class that inherit from monobehaviour

    you add it by dragging monobehaviour script into game object
     
  3. psykick1

    psykick1

    Joined:
    May 19, 2020
    Posts:
    61
    Im pretty sure that monobehaviour is inherit from component and not the reverse.
    So monobehavoiur is component, but component is not monobehaviour..
     
  4. Yanne065

    Yanne065

    Joined:
    Feb 24, 2018
    Posts:
    175
  5. psykick1

    psykick1

    Joined:
    May 19, 2020
    Posts:
    61