# Cluster

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/instanceinterface">Sansar.Script.InstanceInterface</a></span>
</div>

<span id="T:Sansar.Simulation.Cluster"></span>

The Cluster class handles interactions with in game objects.

```csharp
public class Cluster : Sansar.Script.InstanceInterface
```

## Members at a glance

| Kind | Members |
|---|---|
| **Properties** | [ClusterId](#clusterid) · [ObjectPrivateCount](#objectprivatecount) |
| **Methods** | [Destroy](#destroy) · [GetObjectPrivate](#getobjectprivate) · [GetObjectPrivates](#getobjectprivates) · [ToString](#tostring) |

## Properties

### ClusterId

<div class="api-card">
<span id="P:Sansar.Simulation.Cluster.ClusterId"></span>

```csharp signature
public ClusterId ClusterId { get; }
```

Returns the Id of this cluster.

</div>

### ObjectPrivateCount

<div class="api-card">
<span id="P:Sansar.Simulation.Cluster.ObjectPrivateCount"></span>

```csharp signature
public uint ObjectPrivateCount { get; }
```

The current number of objects in this cluster.

</div>


## Methods

### Destroy

<div class="api-card" id="destroy-noargs">
<span id="M:Sansar.Simulation.Cluster.Destroy"></span>
<span id="M:Sansar.Simulation.Cluster.Destroy()"></span>

```csharp signature
public void Destroy()
```

Destroys this cluster.

</div>

<div class="api-card" id="destroy-operationcomplete">
<span id="M:Sansar.Simulation.Cluster.Destroy(Sansar.Script.ScriptBase.OperationComplete)"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong Destroy(
    Sansar.Script.ScriptBase.OperationComplete handler
)
```

Destroys this cluster.

| Parameter | Type | Description |
|---|---|---|
| `handler` | [Sansar.Script.ScriptBase.OperationComplete](/scripting/api/sansar.script/scriptbase.operationcomplete) | Handler to be called when the event completes. |

**Returns:** [ulong](https://learn.microsoft.com/dotnet/api/system.uint64) — The internal event id for the completion event.

</div>

<div class="api-card" id="destroy-action">
<span id="M:Sansar.Simulation.Cluster.Destroy(System.Action{Sansar.Script.OperationCompleteEvent})"></span>

```csharp signature
public void Destroy(
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Destroys this cluster.

| Parameter | Type | Description |
|---|---|---|
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

</div>

### GetObjectPrivate

<div class="api-card">
<span id="M:Sansar.Simulation.Cluster.GetObjectPrivate(System.UInt32)"></span>

```csharp signature
public ObjectPrivate GetObjectPrivate(uint index)
```

Retrieves a Sansar.Simulation.ObjectPrivate by index.

| Parameter | Type | Description |
|---|---|---|
| `index` | [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | Index of the Sansar.Simulation.ObjectPrivate to retrieve. |

**Returns:** [ObjectPrivate](/scripting/api/sansar.simulation/objectprivate) — The Sansar.Simulation.ObjectPrivate at that index or null.

</div>

### GetObjectPrivates

<div class="api-card">
<span id="M:Sansar.Simulation.Cluster.GetObjectPrivates"></span>
<span id="M:Sansar.Simulation.Cluster.GetObjectPrivates()"></span>

```csharp signature
public IEnumerable<ObjectPrivate> GetObjectPrivates()
```

Enumerable for GetObjectPrivate

**Returns:** [IEnumerable&lt;ObjectPrivate&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) — Enumerable for GetObjectPrivate

<details class="api-remarks"><summary>Remarks</summary>

The resulting enumerable may be invalidated if the underlying collection changes.

</details>

</div>

### ToString

<div class="api-card">
<span id="M:Sansar.Simulation.Cluster.ToString"></span>
<span id="M:Sansar.Simulation.Cluster.ToString()"></span>

```csharp signature
public override string ToString()
```

A string representation of this object.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — A string representation of this object.

<details class="api-remarks"><summary>Remarks</summary>

The format of this string may change between releases.

</details>

</div>




<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>