Search Unity

Resolved Sprite as object or as object's component

Discussion in 'Getting Started' started by The_Cat_with_Hands, Feb 1, 2024.

  1. The_Cat_with_Hands

    The_Cat_with_Hands

    Joined:
    Feb 1, 2024
    Posts:
    3
    Hello everyone!
    I am new at Unity and have a question. I watched different tutorials and saw that often people add the sprite as separate game object. I mean they create (for example) game object "Player" where after they will add scripts, and add game object "Player Sprite" after make it the child of object "Player".
    But I can add component "Sprite Renderer" to the object "Player" and it will work. So I don't understand the reason for making sprite as separate object (the example on the picture).
    So maybe there some reason for dealing like that? Thank you for explanation!
     

    Attached Files:

  2. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    There is no big difference between two methods. It's more about consistance and size of project you trying to make.

    But in my personal opinion the way you attached is more preferable. It's easier to manage game objects on the project hierarchy tree compering to one game object that is crowded with many components. At this stage project is simple so you don't see advantages. Same way in programming if your class is to big and complicated it's good practice to split it.
     
    Last edited: Feb 2, 2024
    The_Cat_with_Hands likes this.
  3. The_Cat_with_Hands

    The_Cat_with_Hands

    Joined:
    Feb 1, 2024
    Posts:
    3
    Thank you very much!
     
    AngryProgrammer likes this.