| Name | Description | Code Example |
|---|---|---|
| Create | Creates a new GameObject. You can create an empty GameObject or use primitives like cubes, spheres, etc. This is useful for adding new elements to your scene programmatically. | |
| Find | Searches for a GameObject by name or tag. Use sparingly as it can be slow in large scenes. Prefer assigning references in the Inspector when possible. | |
| Destroy | Removes a GameObject from the scene. You can specify a delay for the destruction. This is useful for creating effects like explosions that linger before disappearing. | |
| Instantiate | Creates a copy of a prefab or existing GameObject. This is commonly used for spawning entities like enemies, projectiles, or collectibles during gameplay. | |
| SetActive | Activates or deactivates a GameObject. This is useful for implementing object pooling, toggling UI elements, or temporarily disabling game elements without destroying them. | |
| Name | Description | Code Example |
|---|---|---|
| Add | Adds a new component to a GameObject. This allows you to extend the functionality of GameObjects dynamically during runtime. | |
| Get | Retrieves a component attached to the GameObject. This is a fundamental operation for interacting with different aspects of a GameObject. | |
| Remove | Removes a component from a GameObject. This can be useful for changing the behavior of objects during gameplay or for cleanup purposes. | |
| Check | Checks if a GameObject has a specific component. This method is more efficient than GetComponent when you only need to check for the presence of a component. | |
| Get Children | Retrieves components from all child GameObjects. This is useful for operations that need to affect all children of an object, like changing materials or adjusting renderers. | |
| Name | Description | Code Example |
|---|---|---|
| Position | Manipulates the position of a GameObject in world space (transform.position) or local space (transform.localPosition). Essential for moving objects in your game. | |
| Rotation | Controls the rotation of a GameObject in world space (transform.rotation) or local space (transform.localRotation). Used for orienting objects in your scene. | |
| Scale | Adjusts the scale of a GameObject. This affects the size of the object and its children. Useful for visual effects or dynamic resizing of objects. | |
| Parent | Sets or changes the parent of a GameObject. This is crucial for organizing your scene hierarchy and creating complex object relationships. | |
| Children | Accesses or manipulates child objects of a GameObject. Useful for traversing hierarchies or performing operations on groups of related objects. | |
| Name | Description | Code Example |
|---|---|---|
| Awake | Called when the script instance is being loaded. Use this for initialization steps that need to happen before Start and don't depend on other objects. | |
| OnEnable | Called when the object becomes enabled and active. Useful for setting up event subscriptions or reactivating behaviors when an object is re-enabled. | |
| Start | Called before the first frame update, after Awake. Use this for initialization that requires other objects to be set up first. | |
| Update | Called once per frame. Use this for frame-based game logic, input handling, and smooth movements. | |
| FixedUpdate | Called at fixed time intervals, ideal for physics calculations as it's independent of frame rate. | |
| LateUpdate | Called after all Update functions have been called. Useful for camera follow scripts or final position adjustments. | |
| OnDisable | Called when the behaviour becomes disabled or inactive. Use this for cleanup, like unsubscribing from events. | |
| OnDestroy | Called when the MonoBehaviour will be destroyed. Use this for final cleanup operations. | |
| Name | Description | Code Example |
|---|---|---|
| OnCollisionEnter | Called when this collider/rigidbody begins touching another. Use this to detect impacts and trigger appropriate responses. | |
| OnCollisionStay | Called once per frame for every collider/rigidbody in contact. Useful for continuous effects while objects are touching. | |
| OnCollisionExit | Called when this collider/rigidbody stops touching another. Use this to end effects that were active during contact. | |
| OnTriggerEnter | Called when the Collider enters a trigger. Ideal for detecting when objects enter specific areas without physical collision. | |
| OnTriggerStay | Called every frame for all triggers that are in contact. Use this for continuous effects in trigger zones. | |
| OnTriggerExit | Called when the Collider has stopped touching the trigger. Use this to end effects that were active in the trigger zone. | |
| Name | Description | Code Example |
|---|---|---|
| Start | Begins a coroutine. Coroutines are useful for spreading tasks across several frames or introducing time-based logic. | |
| Stop | Stops a running coroutine. This is useful for cancelling ongoing effects or animations. | |
| Yield | Pauses the coroutine execution. You can yield for a specific time, until the next frame, or until a condition is met. | |
| WaitUntil | Suspends the coroutine execution until a condition is met. This is useful for creating state-based behaviors. | |
| WaitWhile | Suspends the coroutine execution while a condition is true. This can be used to create loops or delay actions until a state changes. | |