![]() ![]() GameObject.activeInHierarchy is necessary because whether a GameObject is actually active is determined by its own active state and the active state of all of its parents. Use GameObject.activeInHierarchy to read whether the GameObject is actually active in the scene. You can also use GameObject.activeSelf to read the current active state of a GameObject. You can control this using GameObject.SetActive. The GameObject’s active status is represented by the checkbox to the left of the GameObject’s name. This generally means it will become invisible, and not receive any of the normal callbacks or events such as Update or FixedUpdate. GameObjects are active by default, but can be deactivated, which turns off all components attached to the GameObject. Active Status The Active status of a GameObject If you want a quick list of all the available API for the GameObject class, see the GameObject Script Reference. The Scene status properties are outlined in red.Īll GameObjects share a set of controls at the top of the inspector relating to the GameObject’s status within the scene, and these can be controlled via the GameObject’s scripting API. A typical GameObject viewed in the Inspector. They don’t relate to any particular component, and are visible in the inspector of a GameObject at the top, above the list of components. More info See in Glossary when you have a GameObject selected in the Editor. These typically correspond to the controls visible near the top of the inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info See in Glossary to modify many properties related to a GameObject’s status in the scene. You can use scripts A piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. In scripting, the GameObject class provides a collection of methods which allow you to work with them in your code, including finding, making connections and sending messages between GameObjects, and adding or removing components attached to the GameObject, and setting values relating to their status within the scene. GameObjects are the building blocks for scenes in Unity, and act as a container for functional components which determine how the GameObject looks, and what the GameObject does. For an exhaustive reference of every member of the GameObject class, see the GameObject script reference. To learn about using GameObjects in the Scene and Hierarchy in the Unity Editor, see the GameObjects section of the user manual. This page relates to scripting with Unity’s GameObject class. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. Think of each unique Scene file as a unique level. Unity’s GameObject class represents anything which can exist in a Scene A Scene contains the environments and menus of your game. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |