> 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.kspublishservice.md).

# Class ksPublishService

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

Manage state for publishing and running images.

```csharp
public class ksPublishService : ksSingleton<ksPublishService>
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† Object â† ScriptableObject â† [ksSingleton\<ksPublishService>](/reactor/api-reference/ks.unity.editor/ks.unity.editor.kssingleton-1.md) â† [ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md)

#### Inherited Members

[ksSingleton\<ksPublishService>.Get()](/reactor/api-reference/ks.unity.editor/ks.unity.editor.kssingleton-1.md#KS_Unity_Editor_ksSingleton_1_Get), [ksSingleton\<ksPublishService>.Initialize()](/reactor/api-reference/ks.unity.editor/ks.unity.editor.kssingleton-1.md#KS_Unity_Editor_ksSingleton_1_Initialize), [ksSingleton\<ksPublishService>.Create()](/reactor/api-reference/ks.unity.editor/ks.unity.editor.kssingleton-1.md#KS_Unity_Editor_ksSingleton_1_Create), ScriptableObject.SetDirty(), ScriptableObject.CreateInstance(string), ScriptableObject.CreateInstance(Type), ScriptableObject.CreateInstance\<T>(), Object.GetInstanceID(), Object.GetHashCode(), Object.Equals(object), Object.Instantiate(Object, Vector3, Quaternion), Object.Instantiate(Object, Vector3, Quaternion, Transform), Object.Instantiate(Object), Object.Instantiate(Object, Transform), Object.Instantiate(Object, Transform, bool), Object.Instantiate\<T>(T), Object.Instantiate\<T>(T, Vector3, Quaternion), Object.Instantiate\<T>(T, Vector3, Quaternion, Transform), Object.Instantiate\<T>(T, Transform), Object.Instantiate\<T>(T, Transform, bool), Object.Destroy(Object, float), Object.Destroy(Object), Object.DestroyImmediate(Object, bool), Object.DestroyImmediate(Object), Object.FindObjectsOfType(Type), Object.FindObjectsOfType(Type, bool), Object.FindObjectsByType(Type, FindObjectsSortMode), Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode), Object.DontDestroyOnLoad(Object), Object.DestroyObject(Object, float), Object.DestroyObject(Object), Object.FindSceneObjectsOfType(Type), Object.FindObjectsOfTypeIncludingAssets(Type), Object.FindObjectsOfType\<T>(), Object.FindObjectsByType\<T>(FindObjectsSortMode), Object.FindObjectsOfType\<T>(bool), Object.FindObjectsByType\<T>(FindObjectsInactive, FindObjectsSortMode), Object.FindObjectOfType\<T>(), Object.FindObjectOfType\<T>(bool), Object.FindFirstObjectByType\<T>(), Object.FindAnyObjectByType\<T>(), Object.FindFirstObjectByType\<T>(FindObjectsInactive), Object.FindAnyObjectByType\<T>(FindObjectsInactive), Object.FindObjectsOfTypeAll(Type), Object.FindObjectOfType(Type), Object.FindFirstObjectByType(Type), Object.FindAnyObjectByType(Type), Object.FindObjectOfType(Type, bool), Object.FindFirstObjectByType(Type, FindObjectsInactive), Object.FindAnyObjectByType(Type, FindObjectsInactive), Object.ToString(), Object.name, Object.hideFlags, [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

### BoundImage <a href="#ks_reactor_client_unity_editor_kspublishservice_boundimage" id="ks_reactor_client_unity_editor_kspublishservice_boundimage"></a>

The bound image

```csharp
public ksPublishService.ImageInfo BoundImage { get; }
```

#### Property Value

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[ImageInfo](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.imageinfo.md)

### CanMakeRequests <a href="#ks_reactor_client_unity_editor_kspublishservice_canmakerequests" id="ks_reactor_client_unity_editor_kspublishservice_canmakerequests"></a>

Check if we can publish an image.

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

#### Property Value

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

### CanPublish <a href="#ks_reactor_client_unity_editor_kspublishservice_canpublish" id="ks_reactor_client_unity_editor_kspublishservice_canpublish"></a>

Can we send a publish request?

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

#### Property Value

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

### CanStartServer <a href="#ks_reactor_client_unity_editor_kspublishservice_canstartserver" id="ks_reactor_client_unity_editor_kspublishservice_canstartserver"></a>

Can we send a launch request?

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

#### Property Value

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

### Images <a href="#ks_reactor_client_unity_editor_kspublishservice_images" id="ks_reactor_client_unity_editor_kspublishservice_images"></a>

Get the image list. Null if the image list hasn't been fetched at least once.

```csharp
public List<ksPublishService.ImageInfo> Images { get; }
```

#### Property Value

[List](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)<[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[ImageInfo](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.imageinfo.md)>

### Projects <a href="#ks_reactor_client_unity_editor_kspublishservice_projects" id="ks_reactor_client_unity_editor_kspublishservice_projects"></a>

Get a sorted list of project information. Null if the projects haven't been fetched at least once.

```csharp
public List<ksProjectInfo> Projects { get; }
```

#### Property Value

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

### SelectedProject <a href="#ks_reactor_client_unity_editor_kspublishservice_selectedproject" id="ks_reactor_client_unity_editor_kspublishservice_selectedproject"></a>

Get the project info for the current selected project.

```csharp
public ksProjectInfo SelectedProject { get; }
```

#### Property Value

[ksProjectInfo](/reactor/api-reference/ks.unity.editor/ks.unity.editor.ksprojectinfo.md)

### SelectedProjectId <a href="#ks_reactor_client_unity_editor_kspublishservice_selectedprojectid" id="ks_reactor_client_unity_editor_kspublishservice_selectedprojectid"></a>

Get / Set the selected project.

```csharp
public int SelectedProjectId { get; set; }
```

#### Property Value

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

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

Get the server list.

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

#### Property Value

[ksJSON](/reactor/api-reference/ks.reactor/ks.reactor.ksjson.md)

### Sorting <a href="#ks_reactor_client_unity_editor_kspublishservice_sorting" id="ks_reactor_client_unity_editor_kspublishservice_sorting"></a>

Determines how images are sorted.

```csharp
public ksPublishService.SortKey Sorting { get; set; }
```

#### Property Value

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[SortKey](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.sortkey.md)

### VirtualMachines <a href="#ks_reactor_client_unity_editor_kspublishservice_virtualmachines" id="ks_reactor_client_unity_editor_kspublishservice_virtualmachines"></a>

Get the virtual machine list.

```csharp
public ksJSON VirtualMachines { get; }
```

#### Property Value

[ksJSON](/reactor/api-reference/ks.reactor/ks.reactor.ksjson.md)

## Methods

### BindImage(int) <a href="#ks_reactor_client_unity_editor_kspublishservice_bindimage_system_int32" id="ks_reactor_client_unity_editor_kspublishservice_bindimage_system_int32"></a>

Binds the project to an image.

```csharp
public void BindImage(int imageId)
```

#### Parameters

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

Image to bind to.

### GetBoundImageId() <a href="#ks_reactor_client_unity_editor_kspublishservice_getboundimageid" id="ks_reactor_client_unity_editor_kspublishservice_getboundimageid"></a>

Gets the bound image id.

```csharp
public int GetBoundImageId()
```

#### Returns

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

Id of the bound image, or -1 if there is no bound image.

### PublishImage(string, string, ksJSON) <a href="#ks_reactor_client_unity_editor_kspublishservice_publishimage_system_string_system_string_ks_reactor" id="ks_reactor_client_unity_editor_kspublishservice_publishimage_system_string_system_string_ks_reactor"></a>

Publish a Reactor runtime and configs as an image.

```csharp
public bool PublishImage(string name, string version, ksJSON sceneData)
```

#### Parameters

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

Image name

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

Image version

`sceneData` [ksJSON](/reactor/api-reference/ks.reactor/ks.reactor.ksjson.md)

Image scene data

#### Returns

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

### Refresh() <a href="#ks_reactor_client_unity_editor_kspublishservice_refresh" id="ks_reactor_client_unity_editor_kspublishservice_refresh"></a>

Reset fetch times.

```csharp
public void Refresh()
```

### SetSorting(SortKey, SortKey) <a href="#ks_reactor_client_unity_editor_kspublishservice_setsorting_ks_reactor_client_unity_editor_kspublishs" id="ks_reactor_client_unity_editor_kspublishservice_setsorting_ks_reactor_client_unity_editor_kspublishs"></a>

Sets the image [Sorting](#KS_Reactor_Client_Unity_Editor_ksPublishService_Sorting).

```csharp
public void SetSorting(ksPublishService.SortKey sorting, ksPublishService.SortKey reverseSorting)
```

#### Parameters

`sorting` [ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[SortKey](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.sortkey.md)

Sorting key to set. If [Sorting](#KS_Reactor_Client_Unity_Editor_ksPublishService_Sorting) is already this value, sets it to `reverseSorting` instead.

`reverseSorting` [ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[SortKey](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.sortkey.md)

If [Sorting](#KS_Reactor_Client_Unity_Editor_ksPublishService_Sorting) is already set to `sorting`, sets it to this value instead.

### Start() <a href="#ks_reactor_client_unity_editor_kspublishservice_start" id="ks_reactor_client_unity_editor_kspublishservice_start"></a>

Initialization.

```csharp
public void Start()
```

### StartServer(string, string, string, string, string, bool, bool) <a href="#ks_reactor_client_unity_editor_kspublishservice_startserver_system_string_system_string_system_strin" id="ks_reactor_client_unity_editor_kspublishservice_startserver_system_string_system_string_system_strin"></a>

```csharp
public bool StartServer(string imageId, string scene, string room, string name, string location, bool keepAlive, bool isPublic)
```

#### Parameters

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

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

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

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

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

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

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

#### Returns

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

### StopServer(string) <a href="#ks_reactor_client_unity_editor_kspublishservice_stopserver_system_string" id="ks_reactor_client_unity_editor_kspublishservice_stopserver_system_string"></a>

Stop a server.

```csharp
public bool StopServer(string instanceId)
```

#### Parameters

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

Instance ID

#### Returns

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

True if the request was sent.

### Update() <a href="#ks_reactor_client_unity_editor_kspublishservice_update" id="ks_reactor_client_unity_editor_kspublishservice_update"></a>

Called by update.

```csharp
public void Update()
```

### OnBindImage <a href="#ks_reactor_client_unity_editor_kspublishservice_onbindimage" id="ks_reactor_client_unity_editor_kspublishservice_onbindimage"></a>

Invoked when an image is bound.

```csharp
public event ksPublishService.BindImageCallback OnBindImage
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[BindImageCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.bindimagecallback.md)

### OnPublish <a href="#ks_reactor_client_unity_editor_kspublishservice_onpublish" id="ks_reactor_client_unity_editor_kspublishservice_onpublish"></a>

Invoked when an image is published or there are errors when publishing.

```csharp
public event ksPublishService.PublishCallback OnPublish
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[PublishCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.publishcallback.md)

### OnSelectProject <a href="#ks_reactor_client_unity_editor_kspublishservice_onselectproject" id="ks_reactor_client_unity_editor_kspublishservice_onselectproject"></a>

Invoked when the selected project changes.

```csharp
public event ksPublishService.SelectProjectCallback OnSelectProject
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[SelectProjectCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.selectprojectcallback.md)

### OnStartServer <a href="#ks_reactor_client_unity_editor_kspublishservice_onstartserver" id="ks_reactor_client_unity_editor_kspublishservice_onstartserver"></a>

Invoked when a start server command is complete or there is an error starting a server.

```csharp
public event ksPublishService.StartServerCallback OnStartServer
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[StartServerCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.startservercallback.md)

### OnStopServer <a href="#ks_reactor_client_unity_editor_kspublishservice_onstopserver" id="ks_reactor_client_unity_editor_kspublishservice_onstopserver"></a>

Invoked when a stop server command is complete or there is an error stopping a server.

```csharp
public event ksPublishService.StopServerCallback OnStopServer
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[StopServerCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.stopservercallback.md)

### OnUpdateImages <a href="#ks_reactor_client_unity_editor_kspublishservice_onupdateimages" id="ks_reactor_client_unity_editor_kspublishservice_onupdateimages"></a>

Invoked when the image list is updated or there are errors when fetching images.

```csharp
public event ksPublishService.UpdateImagesCallback OnUpdateImages
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[UpdateImagesCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.updateimagescallback.md)

### OnUpdateProjects <a href="#ks_reactor_client_unity_editor_kspublishservice_onupdateprojects" id="ks_reactor_client_unity_editor_kspublishservice_onupdateprojects"></a>

Invoked when the projects list is updated or there are errors when fetching projects.

```csharp
public event ksPublishService.UpdateProjectsCallback OnUpdateProjects
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[UpdateProjectsCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.updateprojectscallback.md)

### OnUpdateServers <a href="#ks_reactor_client_unity_editor_kspublishservice_onupdateservers" id="ks_reactor_client_unity_editor_kspublishservice_onupdateservers"></a>

Invoked when the server list is updated or there are errors when fetching servers.

```csharp
public event ksPublishService.UpdateServersCallback OnUpdateServers
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[UpdateServersCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.updateserverscallback.md)

### OnUpdateVirtualMachines <a href="#ks_reactor_client_unity_editor_kspublishservice_onupdatevirtualmachines" id="ks_reactor_client_unity_editor_kspublishservice_onupdatevirtualmachines"></a>

Invoked when the virtual machine list is updated or there are errors when fetching virtual machines.

```csharp
public event ksPublishService.UpdateVirtualMachinesCallback OnUpdateVirtualMachines
```

#### Event Type

[ksPublishService](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice.md).[UpdateVirtualMachinesCallback](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspublishservice/ks.reactor.client.unity.editor.kspublishservice.updatevirtualmachinescallback.md)
