Search Unity

Question How do you create a new 2D gameobject?

Discussion in 'Getting Started' started by Asough, Feb 20, 2023.

  1. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    151
    I'm following this tutorial, on how to create custom triggers. It says i have to create a new 2d game object, but i don't see that option anywhere?
     

    Attached Files:

    Last edited: May 10, 2023
  2. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    It should normally be there.. Perhaps you'd need to add the 2D-package?
    Window->Package Manager -> 2D (under Features).
     
  3. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    151
    I don't see that anywhere?
     

    Attached Files:

  4. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    At the top, where it says: "Packages: In Project" -> Switch that to "Unity Registry".

    If that doesn't work, try + -> add by name: com.unity.feature.2d (or com.unity.2d.sprite)
     
  5. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    151
    That seems to work. I can now select the 2d submenu, in the gameobject menu. It says in the guide though, that i have to click on the button called sprite, to create a new sprite. If i do that, unity will instead open a whole new menu with different sprites.

    Which one of them should i select?
     

    Attached Files:

  6. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    Any of them. They're just different built-in sprites applied to a SpriteRenderer.
    Like how Cube/Sphere/etc are simply different built-in meshes applied to a Mesh-Filter & -Renderer.
    You can swap out the sprite once you've created the GameObject, which is probably what the guide will have you do.
     
  7. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    151
    It seems to have solved it, so i was able to finish this chapter of the tutorial as well.
     
  8. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    497
    Just an FYI - if you are following the official learn tutorials then they do specify the versions that it is for (you can select which version you are using on that page, so it may change the steps to follow depending upon the version). Ideally, you should select a version that the tutorial is designed for and then use that version of Unity to follow the tutorial. I'm only saying this as the tutorial you have selected if for 2018.x and 2019.x versions, yet you are using a 2021.x version of Unity - so you will find that things are different in the newer editor (like the fact you had to install the 2D package, and the sprite menu is different).

    That's just something to consider as to whether you want to be able to follow the tutorial exactly, or if you are okay with finding the new ways that the newer version does stuff compared to the tutorial (which can slow you down as you have to try to figure out where things may have been moved to in the newer version).
     
  9. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    I've been using the official tutorials on the 2018 and 2019 versions before and they've never worked, only on the more recent 2021 versions.
     
  10. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    151
    Yes, i know. I have already tried to install the same version of unity, that the tutorials were made for.

    It says that the tutorials are not available in that version. I wrote about it in this thread.
     
    Last edited: Mar 1, 2023