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

Adding components to scene in 2d game programly

Discussion in 'Getting Started' started by riaron86, Nov 14, 2019.

  1. riaron86

    riaron86

    Joined:
    Nov 14, 2019
    Posts:
    6
    How to add components to scene programly
     
  2. riaron86

    riaron86

    Joined:
    Nov 14, 2019
    Posts:
    6
    Can you write example, for moreunderstandability
     
    Last edited: Nov 14, 2019
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,022
    Joe-Censored and JoeStrout like this.
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You don't add components to scenes. Components are attached to GameObjects, and GameObjects can be added to scenes. As already mentioned, you'd create a prefab with your component and Instantiate that prefab.