### Method

# Cogl Object set_user_data

#### Declaration [src]

    void
    cogl_object_set_user_data (
      CoglObject* object,
      CoglUserDataKey* key,
      void* user_data,
      CoglUserDataDestroyCallback destroy
    )

#### Description [src]

Associates some private `user_data` with a given `CoglObject`. To later remove the association call `cogl_object_set_user_data()` with the same `key` but NULL for the `user_data`.

This method is not directly available to language bindings.

#### Parameters

`key`

  Type: `CoglUserDataKey`

  The address of a `CoglUserDataKey` which provides a unique value with which to index the private data.

  The data is owned by the caller of the method.

`user_data`

  Type: `void*`

  The data to associate with the given object, or `NULL` to remove a previous association.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`destroy`

  Type: `CoglUserDataDestroyCallback`

  A `CoglUserDataDestroyCallback` to call if the object is destroyed or if the association is removed by later setting `NULL` data for the same key.