> 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.unity.editor/ks.reactor.client.unity.editor.kslocalservermanager.md).

# Class ksLocalServerManager

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

Tracks local Reactor server instances.

```csharp
public class ksLocalServerManager
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksLocalServerManager](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kslocalservermanager.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

### RunningServerCount <a href="#ks_reactor_client_unity_editor_kslocalservermanager_runningservercount" id="ks_reactor_client_unity_editor_kslocalservermanager_runningservercount"></a>

Number of running local server instances.

```csharp
public int RunningServerCount { get; }
```

#### Property Value

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

### Servers <a href="#ks_reactor_client_unity_editor_kslocalservermanager_servers" id="ks_reactor_client_unity_editor_kslocalservermanager_servers"></a>

List of local server instances.

```csharp
public ksLocalServerData Servers { get; }
```

#### Property Value

[ksLocalServerData](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kslocalserverdata.md)

## Methods

### AddServer(ksLocalServer) <a href="#ks_reactor_client_unity_editor_kslocalservermanager_addserver_ks_reactor_client_unity_editor_kslocal" id="ks_reactor_client_unity_editor_kslocalservermanager_addserver_ks_reactor_client_unity_editor_kslocal"></a>

Adds a server instance to the list of running local server instances.

```csharp
public void AddServer(ksLocalServer server)
```

#### Parameters

`server` [ksLocalServer](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kslocalserver.md)

Local server instance to load.

### GetServer(string) <a href="#ks_reactor_client_unity_editor_kslocalservermanager_getserver_system_string" id="ks_reactor_client_unity_editor_kslocalservermanager_getserver_system_string"></a>

Gets a local server instance for a room type. If a local server instance of the room type is running, that instance will be returned. If not, a new instance is created (but not started). GetServer is not aware of local server processes started externally and will not return a local server instance for those processes.

```csharp
public ksLocalServer GetServer(string serverType = "")
```

#### Parameters

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

Type of the local server instance to get or create.

#### Returns

[ksLocalServer](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kslocalserver.md)

Local server instance of the appropriate room type.

### IsLocalServerRunning(string, string) <a href="#ks_reactor_client_unity_editor_kslocalservermanager_islocalserverrunning_system_string_system_string" id="ks_reactor_client_unity_editor_kslocalservermanager_islocalserverrunning_system_string_system_string"></a>

Checks if a local server instance is running a scene and room type

```csharp
public bool IsLocalServerRunning(string scene, string roomType)
```

#### Parameters

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

Scene to check for.

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

Type of room to check for.

#### Returns

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

True if a local server instance is running the specified scene and room type.

### Load(ksLocalServerData) <a href="#ks_reactor_client_unity_editor_kslocalservermanager_load_ks_reactor_client_unity_editor_kslocalserve" id="ks_reactor_client_unity_editor_kslocalservermanager_load_ks_reactor_client_unity_editor_kslocalserve"></a>

Loads running local server instances.

```csharp
public void Load(ksLocalServerData data)
```

#### Parameters

`data` [ksLocalServerData](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kslocalserverdata.md)

Local server instances data to load.

### RemoveServer(ksLocalServer) <a href="#ks_reactor_client_unity_editor_kslocalservermanager_removeserver_ks_reactor_client_unity_editor_kslo" id="ks_reactor_client_unity_editor_kslocalservermanager_removeserver_ks_reactor_client_unity_editor_kslo"></a>

Removes a server instance from the list of running local server instances.

```csharp
public void RemoveServer(ksLocalServer server)
```

#### Parameters

`server` [ksLocalServer](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kslocalserver.md)

Local server instance to remove.

### RemoveStoppedServers() <a href="#ks_reactor_client_unity_editor_kslocalservermanager_removestoppedservers" id="ks_reactor_client_unity_editor_kslocalservermanager_removestoppedservers"></a>

Remove stopped local server instances from the manager.

```csharp
public int RemoveStoppedServers()
```

#### Returns

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

Number of server instances removed from the manager.

### RestartOrRemoveStoppedServers() <a href="#ks_reactor_client_unity_editor_kslocalservermanager_restartorremovestoppedservers" id="ks_reactor_client_unity_editor_kslocalservermanager_restartorremovestoppedservers"></a>

Restarts or removes stopped local server instances, depending on the config setting [RestartOnUpdate](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksreactorconfig/ks.reactor.client.unity.ksreactorconfig.serverconfigs.md#KS_Reactor_Client_Unity_ksReactorConfig_ServerConfigs_RestartOnUpdate).

```csharp
public void RestartOrRemoveStoppedServers()
```

### StartServers() <a href="#ks_reactor_client_unity_editor_kslocalservermanager_startservers" id="ks_reactor_client_unity_editor_kslocalservermanager_startservers"></a>

Start all stopped local server instances.

```csharp
public int StartServers()
```

#### Returns

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

Number of server instances started.

### StopClusterInstances() <a href="#ks_reactor_client_unity_editor_kslocalservermanager_stopclusterinstances" id="ks_reactor_client_unity_editor_kslocalservermanager_stopclusterinstances"></a>

Stops running local server instances that were started by a cluster.

```csharp
public void StopClusterInstances()
```

### StopServers() <a href="#ks_reactor_client_unity_editor_kslocalservermanager_stopservers" id="ks_reactor_client_unity_editor_kslocalservermanager_stopservers"></a>

Stops running local server instances.

```csharp
public int StopServers()
```

#### Returns

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

Number of server instances stopped.
