Skip to content

format

typescript
Component.instanceID

class: Component

description

(Read Only) The instance ID of the object.

Every component created in the scene has a unique instance ID that can be used to identify and compare the uniqueness of components.

parameter

param_nametypedescription

reture

typedescription
numberThe instance ID.

code example

typescript
let go = new GameObject();
// Add a BoxCollider component to the game object
let com = go.AddComponent<BoxCollider>(BoxCollider);
com.instanceID;