Guid Id { get; set; }

robot_2Generated
code_blocksInput

Description

The Id property of a GameObject is a unique identifier represented by a System.Guid. This identifier is automatically assigned to each GameObject upon creation and remains constant throughout the object's lifecycle. It is used to uniquely identify the GameObject within the scene, ensuring that each object can be distinctly referenced.

Usage

Use the Id property when you need to uniquely identify a GameObject within a scene. This can be particularly useful for tracking objects, saving and loading game states, or when performing operations that require a unique reference to a specific GameObject.

Example

// Example of accessing the Id property of a GameObject
GameObject myObject = new GameObject();
System.Guid objectId = myObject.Id;

// Output the unique identifier
Debug.Log($"The unique ID of the GameObject is: {objectId}");