Gameobject

From Pummel Party Mod Documentation
Revision as of 04:12, 27 October 2022 by RBDev (talk | contribs) (Initial content)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Gameobjects are objects that exist in the scene. They show up in the Hierarchy Window and can be organized using parent, child and sibling relationships, determined by their position in the hierarchy relative to other gameobjects. Every gameobject has a name, layer, Transform Component and any other user-added components.

Creating gameobjects

The hierarchy right-click context menu.

Gameobjects can be created from the hierarchy using the options at the bottom of the right-click context menu. These options can also be accessed from the GameObject tab in the toolbar.

Create Empty will create a gameobject with no components attached to it. The gameobject will be created in the root of the hierarchy if nothing is selected, or the GameObject toolbar menu was used. If right click was used on an object in the hierarchy, the new gameobject will be created as a child to the selected gameobject.

All other options in this menu will create a gameobject, but they will already contain a component. This can save time by not having to manually add common components when making gameobjects.

Using gameobjects

Layers

Gameobjects can be placed onto different layers. Leaving the layer as Default is suitable for most gameobjects. The notable exception to this is any gameobject that will be used as the ground in a Board Mod. These should be set to the "WorldGround" layer.

Enable/Disable

Similar to components, gameobjects can be enabled and disabled. When a gameobject is disabled, it will be hidden from the scene view and all components attached to it will stop working. You can still select a disabled gameobject from the hierarchy and adjust its Transform in the scene. A gameobject can be re-enabled by selecting its greyed out name in the Hierarchy window, then re-enabling it from the inspector window with it still selected.

Parenting gameobjects

In the hierarchy, dragging a gameobject and releasing it over another gameobject will make it a child of the target gameobject. Child gameobjects will be positioned, rotated and scaled relative to their parent gameobject. This can be used to build hierarchies of gameobjects that move together as a group. You can achieve this simply by creating an empty gameobject and adding other gameobjects as children on the empty parent. Now whenever the parent moves, the children will all move with it.