# ConstructComponentFromBuffer(TypeIndex, void*)

> Used by codegen. Create an instance of a component type from a given buffer of data

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

```csharp
public static object ConstructComponentFromBuffer(TypeIndex typeIndex, void* data)
```

### Parameters

**** (\[TypeIndex]\(/engine/7000.0/script-reference/unity/entities/typeindex)): Component type index**** (\[void\*]\(https\://learn.microsoft.com/dotnet/api/system.void)): Component instance data

### Returns

| Type                                                           | Description              |
| -------------------------------------------------------------- | ------------------------ |
| [Object](https://learn.microsoft.com/dotnet/api/system.object) | Boxed component instance |
