> 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.client/ks.reactor.client.ksbaseentity.md).

# Class ksBaseEntity

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

Base class for entities. Entities are objects controlled by the server and replicated to clients.

```csharp
public abstract class ksBaseEntity : ksIEntity
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)

#### Derived

[ksEntity](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksentity.md), [ksEntity](/reactor/api-reference/ks.reactor.client.adaptors/ks.reactor.client.adaptors.ksentity.md)

#### Implements

[ksIEntity](/reactor/api-reference/ks.reactor/ks.reactor.ksientity.md)

#### 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.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Properties

### AssetId <a href="#ks_reactor_client_ksbaseentity_assetid" id="ks_reactor_client_ksbaseentity_assetid"></a>

Entity asset id.

```csharp
public uint AssetId { get; }
```

#### Property Value

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

### BaseRoom <a href="#ks_reactor_client_ksbaseentity_baseroom" id="ks_reactor_client_ksbaseentity_baseroom"></a>

Room the entity is in.

```csharp
protected ksBaseRoom BaseRoom { get; }
```

#### Property Value

[ksBaseRoom](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseroom.md)

### CharacterController <a href="#ks_reactor_client_ksbaseentity_charactercontroller" id="ks_reactor_client_ksbaseentity_charactercontroller"></a>

Character controller.

```csharp
public ksICharacterController CharacterController { get; set; }
```

#### Property Value

[ksICharacterController](/reactor/api-reference/ks.reactor/ks.reactor.ksicharactercontroller.md)

### Children <a href="#ks_reactor_client_ksbaseentity_children" id="ks_reactor_client_ksbaseentity_children"></a>

List of the child entities attached to this entity.

```csharp
public ksConstList<ksBaseEntity> Children { get; }
```

#### Property Value

[ksConstList](/reactor/api-reference/ks.reactor/ks.reactor.ksconstlist-1.md)<[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)>

### CollisionFilter <a href="#ks_reactor_client_ksbaseentity_collisionfilter" id="ks_reactor_client_ksbaseentity_collisionfilter"></a>

Determines which entities to collide with and notify of collision/overlap events. Setting to null will throw ArgumentNullException.

```csharp
public ksCollisionFilter CollisionFilter { get; set; }
```

#### Property Value

[ksCollisionFilter](/reactor/api-reference/ks.reactor/ks.reactor.kscollisionfilter.md)

### Id <a href="#ks_reactor_client_ksbaseentity_id" id="ks_reactor_client_ksbaseentity_id"></a>

Entity id

```csharp
public ksEntityId Id { get; }
```

#### Property Value

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

### InputPredictor <a href="#ks_reactor_client_ksbaseentity_inputpredictor" id="ks_reactor_client_ksbaseentity_inputpredictor"></a>

The predictor to use when the entity has a player controller with input enabled.

```csharp
public ksIPredictor InputPredictor { get; set; }
```

#### Property Value

[ksIPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksipredictor.md)

### IsDestroyed <a href="#ks_reactor_client_ksbaseentity_isdestroyed" id="ks_reactor_client_ksbaseentity_isdestroyed"></a>

Is the entity destroyed?

```csharp
public bool IsDestroyed { get; }
```

#### Property Value

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

### IsDestroyedLocally <a href="#ks_reactor_client_ksbaseentity_isdestroyedlocally" id="ks_reactor_client_ksbaseentity_isdestroyedlocally"></a>

Is the entity destroyed locally? Derived classes should implement this. If it returns true and the local player owns the entity with the [DESTROY](/reactor/api-reference/ks.reactor/ks.reactor.ksownerpermissions.md#KS_Reactor_ksOwnerPermissions_DESTROY) permission, a request will be sent to the server to destroy the entity.

```csharp
public virtual bool IsDestroyedLocally { get; }
```

#### Property Value

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

### IsInputPredictorAssigned <a href="#ks_reactor_client_ksbaseentity_isinputpredictorassigned" id="ks_reactor_client_ksbaseentity_isinputpredictorassigned"></a>

Is the predictor to use with a controller that uses input prediction assigned? This is false until the first time [InputPredictor](#KS_Reactor_Client_ksBaseEntity_InputPredictor) is accessed, at which point the getter will call [CreateInputPredictor](#KS_Reactor_Client_ksBaseEntity_CreateInputPredictor_KS_Reactor_Client_ksIPredictor_40_) to create one.

```csharp
protected bool IsInputPredictorAssigned { get; }
```

#### Property Value

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

### IsNonInputPredictorAssigned <a href="#ks_reactor_client_ksbaseentity_isnoninputpredictorassigned" id="ks_reactor_client_ksbaseentity_isnoninputpredictorassigned"></a>

Is the predictor to use without a controller that uses input prediction assigned? This is false until the first time [NonInputPredictor](#KS_Reactor_Client_ksBaseEntity_NonInputPredictor) is accessed, at which point the getter will call [CreateNonInputPredictor](#KS_Reactor_Client_ksBaseEntity_CreateNonInputPredictor_KS_Reactor_Client_ksIPredictor_40_) to create one.

```csharp
protected bool IsNonInputPredictorAssigned { get; }
```

#### Property Value

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

### IsOwner <a href="#ks_reactor_client_ksbaseentity_isowner" id="ks_reactor_client_ksbaseentity_isowner"></a>

Does the local player own this entity?

```csharp
public bool IsOwner { get; }
```

#### Property Value

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

### IsPermanent <a href="#ks_reactor_client_ksbaseentity_ispermanent" id="ks_reactor_client_ksbaseentity_ispermanent"></a>

Is this a permanent entity? Permanent entities never move and cannot be destroyed. They are not synced to clients since the clients should already know where they are.

```csharp
public bool IsPermanent { get; }
```

#### Property Value

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

### IsWaitingForPlayerSpawnResponse <a href="#ks_reactor_client_ksbaseentity_iswaitingforplayerspawnresponse" id="ks_reactor_client_ksbaseentity_iswaitingforplayerspawnresponse"></a>

True if the entity was spawned by the local player and we are waiting for the server to confirm or deny the spawn request.

```csharp
public bool IsWaitingForPlayerSpawnResponse { get; }
```

#### Property Value

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

### LocalOwnerTeleported <a href="#ks_reactor_client_ksbaseentity_localownerteleported" id="ks_reactor_client_ksbaseentity_localownerteleported"></a>

Does the local player own this entity with the transform permission and did they teleport it? Setting does nothing if the local player does not own the entity with the transform permission. This gets reset to false after entity updates are sent to the server.

```csharp
public bool LocalOwnerTeleported { get; set; }
```

#### Property Value

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

### NonInputPredictor <a href="#ks_reactor_client_ksbaseentity_noninputpredictor" id="ks_reactor_client_ksbaseentity_noninputpredictor"></a>

The predictor to use when the entity does not have a player controller with input prediction enabled.

```csharp
public ksIPredictor NonInputPredictor { get; set; }
```

#### Property Value

[ksIPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksipredictor.md)

### OnPropertyChange <a href="#ks_reactor_client_ksbaseentity_onpropertychange" id="ks_reactor_client_ksbaseentity_onpropertychange"></a>

Invoked when an entity property changes. Indexed by property id.

```csharp
public ksEventMap<ksDelegates.PropertyChangeHandler> OnPropertyChange { get; }
```

#### Property Value

[ksEventMap](/reactor/api-reference/ks.reactor/ks.reactor.kseventmap-1.md)<[ksDelegates](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksdelegates.md).[PropertyChangeHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksdelegates/ks.reactor.client.ksdelegates.propertychangehandler.md)>

### OnRPC <a href="#ks_reactor_client_ksbaseentity_onrpc" id="ks_reactor_client_ksbaseentity_onrpc"></a>

Invoked when the server calls an RPC on the room. Indexed by RPC id.

```csharp
public ksEventMap<ksBaseEntity.RPCHandler> OnRPC { get; }
```

#### Property Value

[ksEventMap](/reactor/api-reference/ks.reactor/ks.reactor.kseventmap-1.md)<[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[RPCHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.rpchandler.md)>

### OwnerId <a href="#ks_reactor_client_ksbaseentity_ownerid" id="ks_reactor_client_ksbaseentity_ownerid"></a>

The id of the player who owns this entity.

```csharp
public uint OwnerId { get; }
```

#### Property Value

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

### OwnerPermissions <a href="#ks_reactor_client_ksbaseentity_ownerpermissions" id="ks_reactor_client_ksbaseentity_ownerpermissions"></a>

Owner permission flags.

```csharp
public ksOwnerPermissions OwnerPermissions { get; }
```

#### Property Value

[ksOwnerPermissions](/reactor/api-reference/ks.reactor/ks.reactor.ksownerpermissions.md)

### Parent <a href="#ks_reactor_client_ksbaseentity_parent" id="ks_reactor_client_ksbaseentity_parent"></a>

Get/Set a parent entity to this entity. If the new value is a descendant of this entity, then the parent will not be updated.

```csharp
public ksBaseEntity Parent { get; set; }
```

#### Property Value

[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)

### PlayerController <a href="#ks_reactor_client_ksbaseentity_playercontroller" id="ks_reactor_client_ksbaseentity_playercontroller"></a>

Player controller controlling this entity.

```csharp
public ksPlayerController PlayerController { get; }
```

#### Property Value

[ksPlayerController](/reactor/api-reference/ks.reactor/ks.reactor.ksplayercontroller.md)

### PredictionEnabled <a href="#ks_reactor_client_ksbaseentity_predictionenabled" id="ks_reactor_client_ksbaseentity_predictionenabled"></a>

Is prediction enabled?

```csharp
public bool PredictionEnabled { get; set; }
```

#### Property Value

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

### Predictor <a href="#ks_reactor_client_ksbaseentity_predictor" id="ks_reactor_client_ksbaseentity_predictor"></a>

The predictor that is currently smoothing the transform and properties for the entity. To change the predictor, set either [NonInputPredictor](#KS_Reactor_Client_ksBaseEntity_NonInputPredictor) or [InputPredictor](#KS_Reactor_Client_ksBaseEntity_InputPredictor).

```csharp
public ksIPredictor Predictor { get; }
```

#### Property Value

[ksIPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksipredictor.md)

### Properties <a href="#ks_reactor_client_ksbaseentity_properties" id="ks_reactor_client_ksbaseentity_properties"></a>

Entity properties

```csharp
public ksPropertyMap Properties { get; }
```

#### Property Value

[ksPropertyMap](/reactor/api-reference/ks.reactor/ks.reactor.kspropertymap.md)

### RigidBody <a href="#ks_reactor_client_ksbaseentity_rigidbody" id="ks_reactor_client_ksbaseentity_rigidbody"></a>

The entity's rigid body. Null if the entity does not have a rigid body.

```csharp
public ksIRigidBody RigidBody { get; set; }
```

#### Property Value

[ksIRigidBody](/reactor/api-reference/ks.reactor/ks.reactor.ksirigidbody.md)

### RigidBody2D <a href="#ks_reactor_client_ksbaseentity_rigidbody2d" id="ks_reactor_client_ksbaseentity_rigidbody2d"></a>

The entity's 2D rigid body. Null if the entity does not have a 2D rigid body.

```csharp
public ksIRigidBody2D RigidBody2D { get; set; }
```

#### Property Value

[ksIRigidBody2D](/reactor/api-reference/ks.reactor/ks.reactor.ksirigidbody2d.md)

### ServerTransform <a href="#ks_reactor_client_ksbaseentity_servertransform" id="ks_reactor_client_ksbaseentity_servertransform"></a>

Server transform.

```csharp
public ksIReadOnlyTransform ServerTransform { get; }
```

#### Property Value

[ksIReadOnlyTransform](/reactor/api-reference/ks.reactor/ks.reactor.ksireadonlytransform.md)

### ServerTransform2D <a href="#ks_reactor_client_ksbaseentity_servertransform2d" id="ks_reactor_client_ksbaseentity_servertransform2d"></a>

2D representation of the server transform.

```csharp
public ksIReadOnlyTransform2D ServerTransform2D { get; }
```

#### Property Value

[ksIReadOnlyTransform2D](/reactor/api-reference/ks.reactor/ks.reactor.ksireadonlytransform2d.md)

### SpawnedByLocalPlayer <a href="#ks_reactor_client_ksbaseentity_spawnedbylocalplayer" id="ks_reactor_client_ksbaseentity_spawnedbylocalplayer"></a>

True if the entity was spawned by the local player.

```csharp
public bool SpawnedByLocalPlayer { get; }
```

#### Property Value

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

### SyncGroup <a href="#ks_reactor_client_ksbaseentity_syncgroup" id="ks_reactor_client_ksbaseentity_syncgroup"></a>

The sync group the entity belongs to. Players can only see entities in sync groups they are added to. Entities in sync group zero are always visible.

```csharp
public uint SyncGroup { get; }
```

#### Property Value

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

### Transform <a href="#ks_reactor_client_ksbaseentity_transform" id="ks_reactor_client_ksbaseentity_transform"></a>

Client transform.

```csharp
public ksIReadOnlyTransform Transform { get; }
```

#### Property Value

[ksIReadOnlyTransform](/reactor/api-reference/ks.reactor/ks.reactor.ksireadonlytransform.md)

### Transform2D <a href="#ks_reactor_client_ksbaseentity_transform2d" id="ks_reactor_client_ksbaseentity_transform2d"></a>

2D client transform.

```csharp
public ksIReadOnlyTransform2D Transform2D { get; }
```

#### Property Value

[ksIReadOnlyTransform2D](/reactor/api-reference/ks.reactor/ks.reactor.ksireadonlytransform2d.md)

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

Entity type

```csharp
public string Type { get; protected set; }
```

#### Property Value

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

## Methods

### AttachScripts() <a href="#ks_reactor_client_ksbaseentity_attachscripts" id="ks_reactor_client_ksbaseentity_attachscripts"></a>

Attaches entity scripts. The default implementation does nothing.

```csharp
protected virtual void AttachScripts()
```

### CallRPC(uint, params ksMultiType\[]) <a href="#ks_reactor_client_ksbaseentity_callrpc_system_uint32_ks_reactor_ksmultitype" id="ks_reactor_client_ksbaseentity_callrpc_system_uint32_ks_reactor_ksmultitype"></a>

Calls an RPC on this entity on the server.

```csharp
public void CallRPC(uint rpcId, params ksMultiType[] arguments)
```

#### Parameters

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

rpcId of rpc to call.

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

arguments to send to server.

### CleanUp() <a href="#ks_reactor_client_ksbaseentity_cleanup" id="ks_reactor_client_ksbaseentity_cleanup"></a>

Cleanup the object for reuse.

```csharp
protected void CleanUp()
```

### CreateInputPredictor(out ksIPredictor) <a href="#ks_reactor_client_ksbaseentity_createinputpredictor_ks_reactor_client_ksipredictor" id="ks_reactor_client_ksbaseentity_createinputpredictor_ks_reactor_client_ksipredictor"></a>

```csharp
protected virtual bool CreateInputPredictor(out ksIPredictor predictor)
```

#### Parameters

`predictor` [ksIPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksipredictor.md)

#### Returns

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

### CreateNonInputPredictor(out ksIPredictor) <a href="#ks_reactor_client_ksbaseentity_createnoninputpredictor_ks_reactor_client_ksipredictor" id="ks_reactor_client_ksbaseentity_createnoninputpredictor_ks_reactor_client_ksipredictor"></a>

Creates a predictor to use when the entity does not have a player controller with input prediction enabled.

```csharp
protected virtual bool CreateNonInputPredictor(out ksIPredictor predictor)
```

#### Parameters

`predictor` [ksIPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksipredictor.md)

The predictor created.

#### Returns

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

False if the predictor could not be created.

### Destroy(ksDestroyReason) <a href="#ks_reactor_client_ksbaseentity_destroy_ks_reactor_client_ksdestroyreason" id="ks_reactor_client_ksbaseentity_destroy_ks_reactor_client_ksdestroyreason"></a>

Destroys the entity.

```csharp
protected abstract void Destroy(ksDestroyReason reason)
```

#### Parameters

`reason` [ksDestroyReason](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksdestroyreason.md)

The reason the entity was destroyed.

### ForEachDescendant(Action\<ksBaseEntity>) <a href="#ks_reactor_client_ksbaseentity_foreachdescendant_system_action_ks_reactor_client_ksbaseentity" id="ks_reactor_client_ksbaseentity_foreachdescendant_system_action_ks_reactor_client_ksbaseentity"></a>

Iterate all descendants and invoke a callback with each.

```csharp
public void ForEachDescendant(Action<ksBaseEntity> callback)
```

#### Parameters

`callback` [Action](https://learn.microsoft.com/dotnet/api/system.action-1)<[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)>

### GetColliders() <a href="#ks_reactor_client_ksbaseentity_getcolliders" id="ks_reactor_client_ksbaseentity_getcolliders"></a>

Gets the entity's colliders.

```csharp
public virtual List<ksICollider> GetColliders()
```

#### Returns

[List](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)<[ksICollider](/reactor/api-reference/ks.reactor/ks.reactor.ksicollider.md)>

List of the entity's colliders.

### GetPropertyServerValue(uint) <a href="#ks_reactor_client_ksbaseentity_getpropertyservervalue_system_uint32" id="ks_reactor_client_ksbaseentity_getpropertyservervalue_system_uint32"></a>

Gets property server value. If a property id is not in the map, a [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md) of type [NULL](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype/ks.reactor.ksmultitype.types.md#KS_Reactor_ksMultiType_Types_NULL) is returned.

```csharp
public ksMultiType GetPropertyServerValue(uint propertyId)
```

#### Parameters

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

#### Returns

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

### GetTransformUpdate(ksTransformState) <a href="#ks_reactor_client_ksbaseentity_gettransformupdate_ks_reactor_kstransformstate" id="ks_reactor_client_ksbaseentity_gettransformupdate_ks_reactor_kstransformstate"></a>

Gets an updated transform to send to the server. This is called on locally-owned entities with the [TRANSFORM](/reactor/api-reference/ks.reactor/ks.reactor.ksownerpermissions.md#KS_Reactor_ksOwnerPermissions_TRANSFORM) permission. You must implement this to get transform state from the game state and apply it to `transform`. If you set a value on `transform`, it will set a dirty flag for that value and generate an update to send to the server, even if that value did not change. You should check if the value changed before setting a value.

```csharp
protected virtual void GetTransformUpdate(ksTransformState transform)
```

#### Parameters

`transform` [ksTransformState](/reactor/api-reference/ks.reactor/ks.reactor.kstransformstate.md)

Transform to update.

### HasOwnerPermission(ksOwnerPermissions) <a href="#ks_reactor_client_ksbaseentity_hasownerpermission_ks_reactor_ksownerpermissions" id="ks_reactor_client_ksbaseentity_hasownerpermission_ks_reactor_ksownerpermissions"></a>

Checks if the local player owns the entity and has any of the `permissions`.

```csharp
public bool HasOwnerPermission(ksOwnerPermissions permissions)
```

#### Parameters

`permissions` [ksOwnerPermissions](/reactor/api-reference/ks.reactor/ks.reactor.ksownerpermissions.md)

Permissions to check for.

#### Returns

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

True if the local player owns the entity and has any of the `permissions`.

### Initialize(ksEntityId, uint, ksTransformState, ksBaseRoom, ksSpawnParams) <a href="#ks_reactor_client_ksbaseentity_initialize_ks_reactor_ksentityid_system_uint32_ks_reactor_kstransform" id="ks_reactor_client_ksbaseentity_initialize_ks_reactor_ksentityid_system_uint32_ks_reactor_kstransform"></a>

Initializes the entity.

```csharp
protected void Initialize(ksEntityId entityId, uint assetId, ksTransformState transform, ksBaseRoom room, ksSpawnParams spawnParams = null)
```

#### Parameters

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

Entity id

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

Asset id

`transform` [ksTransformState](/reactor/api-reference/ks.reactor/ks.reactor.kstransformstate.md)

Entity transform

`room` [ksBaseRoom](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseroom.md)

Room the entity belongs to.

`spawnParams` [ksSpawnParams](/reactor/api-reference/ks.reactor/ks.reactor.ksspawnparams.md)

If the entity was spawned by the local player, this is the spawn parameters object used to spawn the entity, otherwise it is null.

### Initialize(ksSpawnParams) <a href="#ks_reactor_client_ksbaseentity_initialize_ks_reactor_ksspawnparams" id="ks_reactor_client_ksbaseentity_initialize_ks_reactor_ksspawnparams"></a>

Implement this to initialize data for your entity. This is called after the initial server data for the entity is synced, which includes the entity id, asset id, transform, player controller, and properties. The default implementation does nothing.

```csharp
protected virtual void Initialize(ksSpawnParams spawnParams)
```

#### Parameters

`spawnParams` [ksSpawnParams](/reactor/api-reference/ks.reactor/ks.reactor.ksspawnparams.md)

If the entity was spawned by the local player, this is the spawn parameters object used to spawn the entity, otherwise it is null.

### InitializeScripts() <a href="#ks_reactor_client_ksbaseentity_initializescripts" id="ks_reactor_client_ksbaseentity_initializescripts"></a>

Initializes entity scripts. The default implementation does nothing.

```csharp
protected virtual void InitializeScripts()
```

### InvokeRPC(uint, ksMultiType\[]) <a href="#ks_reactor_client_ksbaseentity_invokerpc_system_uint32_ks_reactor_ksmultitype" id="ks_reactor_client_ksbaseentity_invokerpc_system_uint32_ks_reactor_ksmultitype"></a>

Invoke managed RPCs on all entity scripts.

```csharp
protected virtual bool InvokeRPC(uint rpcId, ksMultiType[] rpcArgs)
```

#### Parameters

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

RPC ID

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

RPC arguments

#### Returns

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

True if the method invoked any RPC handler

### OwnershipChanged() <a href="#ks_reactor_client_ksbaseentity_ownershipchanged" id="ks_reactor_client_ksbaseentity_ownershipchanged"></a>

Called when owner id or owner permissions change. Derived classes can implement this to take action when ownership changes. The default implementation does nothing.

```csharp
protected virtual void OwnershipChanged()
```

### PlayerSpawnConfirmed() <a href="#ks_reactor_client_ksbaseentity_playerspawnconfirmed" id="ks_reactor_client_ksbaseentity_playerspawnconfirmed"></a>

Called when an entity spawned by the local player is confirmed as spawned by the server. Derived classes can implement this to take action when a spawn is confirmed. The default implementation does nothing.

```csharp
protected virtual void PlayerSpawnConfirmed()
```

### RegisterRPC(uint, RPCHandler) <a href="#ks_reactor_client_ksbaseentity_registerrpc_system_uint32_ks_reactor_client_ksbaseentity_rpchandler" id="ks_reactor_client_ksbaseentity_registerrpc_system_uint32_ks_reactor_client_ksbaseentity_rpchandler"></a>

Register an RPC

```csharp
public void RegisterRPC(uint rpcId, ksBaseEntity.RPCHandler rpcHandler)
```

#### Parameters

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

RPC Id

`rpcHandler` [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[RPCHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.rpchandler.md)

RPC handler

### UnregisterRPC(uint, RPCHandler) <a href="#ks_reactor_client_ksbaseentity_unregisterrpc_system_uint32_ks_reactor_client_ksbaseentity_rpchandler" id="ks_reactor_client_ksbaseentity_unregisterrpc_system_uint32_ks_reactor_client_ksbaseentity_rpchandler"></a>

Unregister an RPC

```csharp
public void UnregisterRPC(uint rpcId, ksBaseEntity.RPCHandler rpcHandler)
```

#### Parameters

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

RPC Id

`rpcHandler` [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[RPCHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.rpchandler.md)

RPC handler

### UpdateEntityTransform() <a href="#ks_reactor_client_ksbaseentity_updateentitytransform" id="ks_reactor_client_ksbaseentity_updateentitytransform"></a>

Calls [GetTransformUpdate](#KS_Reactor_Client_ksBaseEntity_GetTransformUpdate_KS_Reactor_ksTransformState_) to update the [Transform](#KS_Reactor_Client_ksBaseEntity_Transform) if the local player owns the entity with the transform permission. Normally you should not need to call this, as [GetTransformUpdate](#KS_Reactor_Client_ksBaseEntity_GetTransformUpdate_KS_Reactor_ksTransformState_) is called automatically for owned entities with the transform permission before the client sends entity updates to the server. Calling this will not make the entity update sent sooner. It can be used to force the call to happen early if needed, such as when a game object is being destroyed and we need to get the final transform data from it before it is destroyed.

```csharp
protected void UpdateEntityTransform()
```

### UpdateTransform(DirtyFlag) <a href="#ks_reactor_client_ksbaseentity_updatetransform_ks_reactor_ksreadonlytransformstate_dirtyflag" id="ks_reactor_client_ksbaseentity_updatetransform_ks_reactor_ksreadonlytransformstate_dirtyflag"></a>

Use this to apply transform changes to the game state.

```csharp
protected virtual void UpdateTransform(ksReadOnlyTransformState.DirtyFlag flags = DirtyFlag.ALL)
```

#### Parameters

`flags` [ksReadOnlyTransformState](/reactor/api-reference/ks.reactor/ks.reactor.ksreadonlytransformstate.md).[DirtyFlag](/reactor/api-reference/ks.reactor/ks.reactor.ksreadonlytransformstate/ks.reactor.ksreadonlytransformstate.dirtyflag.md)

Flags indicating which tranform components (position/rotation/scale) to update.

### OnConfirmPlayerSpawn <a href="#ks_reactor_client_ksbaseentity_onconfirmplayerspawn" id="ks_reactor_client_ksbaseentity_onconfirmplayerspawn"></a>

Invoked when an entity spawned by the local player is confirmed as spawned by the server.

```csharp
public event ksBaseEntity.ConfirmPlayerSpawnHandler OnConfirmPlayerSpawn
```

#### Event Type

[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[ConfirmPlayerSpawnHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.confirmplayerspawnhandler.md)

### OnControllerChange <a href="#ks_reactor_client_ksbaseentity_oncontrollerchange" id="ks_reactor_client_ksbaseentity_oncontrollerchange"></a>

Invoked when the player controller changes.

```csharp
public event ksBaseEntity.ControllerChangeHandler OnControllerChange
```

#### Event Type

[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[ControllerChangeHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.controllerchangehandler.md)

### OnDestroy <a href="#ks_reactor_client_ksbaseentity_ondestroy" id="ks_reactor_client_ksbaseentity_ondestroy"></a>

Invoked when the entity is destroyed.

```csharp
public event ksBaseEntity.DestroyHandler OnDestroy
```

#### Event Type

[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[DestroyHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.destroyhandler.md)

### OnOwnershipChange <a href="#ks_reactor_client_ksbaseentity_onownershipchange" id="ks_reactor_client_ksbaseentity_onownershipchange"></a>

Invoked when the owner or owner permissions change.

```csharp
public event ksBaseEntity.OwnershipChangeHandler OnOwnershipChange
```

#### Event Type

[ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md).[OwnershipChangeHandler](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity/ks.reactor.client.ksbaseentity.ownershipchangehandler.md)
