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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

AddComponent cannot AddComponent

Discussion in 'Editor & General Support' started by sirio21, Jul 19, 2016.

  1. sirio21

    sirio21

    Joined:
    Mar 11, 2013
    Posts:
    114
    Hi,, sure that is a stupid question but i cannot do it!!

    I dont find how to do it...


    BoxCollider2D bcol = new BoxCollider2D();

    GameObject go = new GameObject("kk");
    go.AddComponent < (BoxCollider2D)bcol >(); // here how i can add the collider to the go?
     
  2. sirio21

    sirio21

    Joined:
    Mar 11, 2013
    Posts:
    114
    ops, this thread goes to script section,,, can i delete it?