> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md).

# Struct ksEntityId

Namespace: [KS.Reactor](/reactor/api-reference/ks.reactor.md)\
Assembly: KSCommon.dll

An entity id uint with type information. The type can be a server entity id or a temporary spawn id that players use to identify entities they spawned before the server confirms the spawn and sends the server entity id. Internally the id is just a uint and the type is determined by which bits are set. If the highest bit is set, it's a temporary spawn id, otherwise it's a server entity id, unless the value is zero in which case it is invalid. Temporary spawn ids are not enough to identify an entity on the server; the id of the player who spawned the entity is also needed.

```csharp
public struct ksEntityId : ksISerializable, IEquatable<ksEntityId>
```

#### Implements

[ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md), [IEquatable\<ksEntityId>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Constructors

### ksEntityId(uint) <a href="#ks_reactor_ksentityid__ctor_system_uint32" id="ks_reactor_ksentityid__ctor_system_uint32"></a>

Constructor

```csharp
public ksEntityId(uint id)
```

#### Parameters

`id` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)

Id

## Fields

### SPAWN\_ID\_START <a href="#ks_reactor_ksentityid_spawn_id_start" id="ks_reactor_ksentityid_spawn_id_start"></a>

The lowest spawn id value.

```csharp
public const uint SPAWN_ID_START = 2147483648
```

#### Field Value

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)

## Properties

### Type <a href="#ks_reactor_ksentityid_type" id="ks_reactor_ksentityid_type"></a>

Id type

```csharp
public ksEntityId.Types Type { get; }
```

#### Property Value

[ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md).[Types](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid/ks.reactor.ksentityid.types.md)

## Methods

### Deserialize(ksStreamBuffer) <a href="#ks_reactor_ksentityid_deserialize_ks_reactor_ksstreambuffer" id="ks_reactor_ksentityid_deserialize_ks_reactor_ksstreambuffer"></a>

Deserializes the id from a buffer.

```csharp
public void Deserialize(ksStreamBuffer buffer)
```

#### Parameters

`buffer` [ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md)

Buffer to deserialize from.

### Equals(ksEntityId) <a href="#ks_reactor_ksentityid_equals_ks_reactor_ksentityid" id="ks_reactor_ksentityid_equals_ks_reactor_ksentityid"></a>

Checks if this id is equal to another.

```csharp
public bool Equals(ksEntityId other)
```

#### Parameters

`other` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the ids are equal.

### Equals(object) <a href="#ks_reactor_ksentityid_equals_system_object" id="ks_reactor_ksentityid_equals_system_object"></a>

Checks if this id is equal to an object.

```csharp
public override bool Equals(object obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the object was an equivalent id.

### GetHashCode() <a href="#ks_reactor_ksentityid_gethashcode" id="ks_reactor_ksentityid_gethashcode"></a>

Gets a hash code.

```csharp
public override int GetHashCode()
```

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)

Hash code

### Serialize(ksStreamBuffer) <a href="#ks_reactor_ksentityid_serialize_ks_reactor_ksstreambuffer" id="ks_reactor_ksentityid_serialize_ks_reactor_ksstreambuffer"></a>

Serializes the id to a buffer.

```csharp
public void Serialize(ksStreamBuffer buffer)
```

#### Parameters

`buffer` [ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md)

Buffer to serialize to.

### ToString() <a href="#ks_reactor_ksentityid_tostring" id="ks_reactor_ksentityid_tostring"></a>

Converts the id number to a string. If it is zero, the string "Unassigned" is returned.

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

#### Returns

[string](https://learn.microsoft.com/dotnet/api/system.string)

The id as a string

## Operators

### operator ==(ksEntityId, ksEntityId) <a href="#ks_reactor_ksentityid_op_equality_ks_reactor_ksentityid_ks_reactor_ksentityid" id="ks_reactor_ksentityid_op_equality_ks_reactor_ksentityid_ks_reactor_ksentityid"></a>

Checks if two ids are equal.

```csharp
public static bool operator ==(ksEntityId lhs, ksEntityId rhs)
```

#### Parameters

`lhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

`rhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the ids are equal

### operator >(ksEntityId, ksEntityId) <a href="#ks_reactor_ksentityid_op_greaterthan_ks_reactor_ksentityid_ks_reactor_ksentityid" id="ks_reactor_ksentityid_op_greaterthan_ks_reactor_ksentityid_ks_reactor_ksentityid"></a>

Checks if `lhs` is greater than `rhs`.

```csharp
public static bool operator >(ksEntityId lhs, ksEntityId rhs)
```

#### Parameters

`lhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

`rhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if `lhs` is greater than `rhs`.

### implicit operator ksEntityId(uint) <a href="#ks_reactor_ksentityid_op_implicit_system_uint32__ks_reactor_ksentityid" id="ks_reactor_ksentityid_op_implicit_system_uint32__ks_reactor_ksentityid"></a>

Implicit conversion from uint.

```csharp
public static implicit operator ksEntityId(uint id)
```

#### Parameters

`id` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)

Id

#### Returns

[ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

### implicit operator uint(ksEntityId) <a href="#ks_reactor_ksentityid_op_implicit_ks_reactor_ksentityid__system_uint32" id="ks_reactor_ksentityid_op_implicit_ks_reactor_ksentityid__system_uint32"></a>

Implicit conversion to uint.

```csharp
public static implicit operator uint(ksEntityId id)
```

#### Parameters

`id` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

Id

#### Returns

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)

### implicit operator ksEntityId(ksMultiType) <a href="#ks_reactor_ksentityid_op_implicit_ks_reactor_ksmultitype__ks_reactor_ksentityid" id="ks_reactor_ksentityid_op_implicit_ks_reactor_ksmultitype__ks_reactor_ksentityid"></a>

Implicit conversion from [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md).

```csharp
public static implicit operator ksEntityId(ksMultiType value)
```

#### Parameters

`value` [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)

Value

#### Returns

[ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

### implicit operator ksMultiType(ksEntityId) <a href="#ks_reactor_ksentityid_op_implicit_ks_reactor_ksentityid__ks_reactor_ksmultitype" id="ks_reactor_ksentityid_op_implicit_ks_reactor_ksentityid__ks_reactor_ksmultitype"></a>

Implicit conversion to [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md).

```csharp
public static implicit operator ksMultiType(ksEntityId id)
```

#### Parameters

`id` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

Id

#### Returns

[ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)

### operator !=(ksEntityId, ksEntityId) <a href="#ks_reactor_ksentityid_op_inequality_ks_reactor_ksentityid_ks_reactor_ksentityid" id="ks_reactor_ksentityid_op_inequality_ks_reactor_ksentityid_ks_reactor_ksentityid"></a>

Checks if two ids are not equal.

```csharp
public static bool operator !=(ksEntityId lhs, ksEntityId rhs)
```

#### Parameters

`lhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

`rhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the ids are not equal.

### operator <(ksEntityId, ksEntityId) <a href="#ks_reactor_ksentityid_op_lessthan_ks_reactor_ksentityid_ks_reactor_ksentityid" id="ks_reactor_ksentityid_op_lessthan_ks_reactor_ksentityid_ks_reactor_ksentityid"></a>

Checks if `lhs` is less than `rhs`.

```csharp
public static bool operator <(ksEntityId lhs, ksEntityId rhs)
```

#### Parameters

`lhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

`rhs` [ksEntityId](/reactor/api-reference/ks.reactor/ks.reactor.ksentityid.md)

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if `lhs` is less than `rhs`.
