# InstanceObject

## Description

Copies an object into a new ID, the new object shares vertex data with the original object. The original object must exist for the instanced object to draw properly. Instancing an object that is already an instance will do nothing. Instancing an object and then deleting the original will probably crash. Setting a shader on an instance object is allowed as long as the vertex attributes used by the shader match exactly in name and order as those used on the shader of the original object. Setting different images on the instance and original object is supported.

## Definition

InstanceObject( newobjID, objID )

void agk::InstanceObject( UINT newobjID, UINT objID )

integer InstanceObject( objID )

UINT agk::InstanceObject( UINT objID )

## Parameters

- newobjID - The ID of the new object.
- objID - The ID of the object to copy.