Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

What is GameObject, GameManager, etc?

Discussion in 'Scripting' started by Galactic_CakeYT, Jun 3, 2020.

  1. Galactic_CakeYT

    Galactic_CakeYT

    Joined:
    Apr 28, 2020
    Posts:
    65
    Sorry I would search what these are, but I have no clue what these are called, could someone tell me what is the purpose of GameObject, GameManager, UIManager, etc, because I think I have an idea, but I still don't know what's their purpose. Also what are these terms for these words?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    A GameObject is a specific Unity API thing:

    https://docs.unity3d.com/ScriptReference/GameObject.html

    The terms GameManager and UIManager are loose terms, sort of like "door" and "car." You would make a GameManager or UIManager according to what you want, but those names imply they manage the game or manage the UI (in some indeterminate fashion), much like a door could be a trapdoor, front door, castle door, house door, etc.

    Fortunately there are GameManager tutorials and some of them have either better or worse descriptions of what they do exactly.
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,888
    GameObjects are the basic building block of any Unity game. At a high level, GameObjects are the only thing that actually exists in a given scene. But on their own they don't do much. They need the help of Components to give them behaviors. Attaching Components to a GameObject is how you get the GameObjects to actually do things! Components are things like Cameras, Rigidbodies, Colliders, etc.. Any MonoBehaviour script you write is also a Component that must be attached to a GameObject to work.

    GameManager, UIManager are just common names for custom Components (MonoBehaviours) that people write to handle certain high level functionality of their games.

    Understanding the relationship between GameObjects and components is absolutely key to really understanding how Unity works.

    See more here https://docs.unity3d.com/Manual/Components.html
     
  4. Galactic_CakeYT

    Galactic_CakeYT

    Joined:
    Apr 28, 2020
    Posts:
    65
    Thanks, also another question, what is a virtual void? I understand that it is related to overriding in Abstract Classes I am pretty sure. But I didn't understand what they are.
     
  5. Galactic_CakeYT

    Galactic_CakeYT

    Joined:
    Apr 28, 2020
    Posts:
    65
    Thanks
     
  6. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,888
    So the things you're calling "voids" are actually called "methods", or "functions". "void" means that the method doesn't return any value, but a method can actually return data of any type, in which case that type name would precede the method name instead of void.

    Virtual is another modifier on a method that has to do with a concept called polymorphism, which allows a class to inherit the behavior of another class (So that you have a parent class and a child class). It's a complicated subject, but in that context, a virtual method is one which a child class is permitted to override the behavior of by providing its own override version of the method.
     
  7. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    @PraetorBlue gave a good explanation of what it is in a broad sense, but with the level of experience it seems you have, I'm guessing that you're seeing this code somewhere and want to understand it. With that in mind, we would be able to give better and more relatable explanations if you could include the context in which you've seen the code, and need to understand it.
     
    Joe-Censored likes this.
  8. Galactic_CakeYT

    Galactic_CakeYT

    Joined:
    Apr 28, 2020
    Posts:
    65
    I was learning about Abstract Classes, in a Unity tutorial course, C# survival guide, but I got the idea