Skip to content

GameObjects

AlienTina edited this page Oct 15, 2023 · 3 revisions

Creation:

GameObject gameObject = new GameObject();
GameObject gameObject = new GameObject(string name);
GameObject gameObject = new GameObject(string name, List<Component> components);

Usage:

  • GameObject.Name(string): The name of the GameObject. Used when trying to find a GameObject in a scene.

  • GameObject.Tag(string): Currently unused. Should be another way to find a GameObject.

  • GameObject.transform(Transform): The transform component of the GameObject (GameObjects get given a Transform Component seperate of the components list)

  • GameObject.Active(bool): If false, GameObjects stops being updated and rendered.

  • GameObject.children(List): A list of all the object's children. Children move together with the parent.

  • GameObject.parent(Transform): The object's parent.

  • GameObject.AddComponent(Component)(function): Used to add a component onto GameObjects.

  • GameObject.RemoveComponent(Component)(function): Used to get rid of a component of a GameObject.

  • GameObject.GetComponent(Type)(Component): Used to find a certain type of Component.

  • GameObject.GetComponents(Type)(List<Component): Used to find multiple instances of a certain type of Component.

  • GameObject.Update(GameTime)(function): Gets called every frame, used to cycle through every component's update method.

  • GameObject.Draw()(function): Handles rendering. Used to cycle through every component's draw method.

Clone this wiki locally