# PiXYZAPI

> Class

Inheritance

* [object](https://learn.microsoft.com/dotnet/api/system.object)
* [Interface](./api_interface)
* PiXYZAPI

***

Inherited Members

* [Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\))

* [Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\))

* [GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

* [GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)

* [MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

* [ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

* [ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

***

Namespace: UnityEngine.Pixyz.API

```csharp
public class PiXYZAPI : Interface
```

## Constructors

### PiXYZAPI(IntPtr)

```csharp
public PiXYZAPI(IntPtr session)
```

Parameters

| Type                                                           | Name    | Description |
| -------------------------------------------------------------- | ------- | ----------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | session |             |

## Fields

### Session

```csharp
public IntPtr Session { get; }
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) |             |

### ProductName

```csharp
public string ProductName { get; }
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Core

```csharp
public CoreInterface Core { get; }
```

Returns

| Type                                  | Description |
| ------------------------------------- | ----------- |
| [CoreInterface](./core_coreinterface) |             |

### Geom

```csharp
public GeomInterface Geom { get; }
```

Returns

| Type                                  | Description |
| ------------------------------------- | ----------- |
| [GeomInterface](./geom_geominterface) |             |

### Material

```csharp
public MaterialInterface Material { get; }
```

Returns

| Type                                              | Description |
| ------------------------------------------------- | ----------- |
| [MaterialInterface](./material_materialinterface) |             |

### Polygonal

```csharp
public PolygonalInterface Polygonal { get; }
```

Returns

| Type                                                 | Description |
| ---------------------------------------------------- | ----------- |
| [PolygonalInterface](./polygonal_polygonalinterface) |             |

### CAD

```csharp
public CADInterface CAD { get; }
```

Returns

| Type                               | Description |
| ---------------------------------- | ----------- |
| [CADInterface](./cad_cadinterface) |             |

### Algo

```csharp
public AlgoInterface Algo { get; }
```

Returns

| Type                                  | Description |
| ------------------------------------- | ----------- |
| [AlgoInterface](./algo_algointerface) |             |

### Scene

```csharp
public SceneInterface Scene { get; }
```

Returns

| Type                                     | Description |
| ---------------------------------------- | ----------- |
| [SceneInterface](./scene_sceneinterface) |             |

### View

```csharp
public ViewInterface View { get; }
```

Returns

| Type                                  | Description |
| ------------------------------------- | ----------- |
| [ViewInterface](./view_viewinterface) |             |

### IO

```csharp
public IOInterface IO { get; }
```

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [IOInterface](./io_iointerface) |             |

### Unity

```csharp
public UnityInterface Unity { get; }
```

Returns

| Type                                     | Description |
| ---------------------------------------- | ----------- |
| [UnityInterface](./unity_unityinterface) |             |

### SessionId

Get the session ID of the current session.

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

Returns

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

## Methods

### GetLastError

```csharp
public static string GetLastError()
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Initialize

Initialize Pixyz API and create a new session.

```csharp
public static PiXYZAPI Initialize(string productName = "", string validationKey = "", string[] optionalTokenList = null, string license = "")
```

Parameters

| Type                                                               | Name              | Description                                |
| ------------------------------------------------------------------ | ----------------- | ------------------------------------------ |
| [string](https://learn.microsoft.com/dotnet/api/system.string)     | productName       | Product name.                              |
| [string](https://learn.microsoft.com/dotnet/api/system.string)     | validationKey     | Product validation key.                    |
| [string\[\]](https://learn.microsoft.com/dotnet/api/system.string) | optionalTokenList | Token list to initialize the product with. |
| [string](https://learn.microsoft.com/dotnet/api/system.string)     | license           | License file (content).                    |

Returns

| Type                       | Description |
| -------------------------- | ----------- |
| [PiXYZAPI](./api_pixyzapi) |             |

### Release

Release Pixyz API and clear the session.

```csharp
public void Release()
```

### ActiveSessions

List all active sessions.

```csharp
public static List<PiXYZAPI> ActiveSessions()
```

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [List\<PiXYZAPI>](./api_pixyzapi) |             |

### SetUnityLicenseClientChannels

Set the licensing channel name to use if using a Unity license. Use if the licensing client was launched by another process (e.g the Unity Hub or the Unity Editor).Should be called before initialization.

```csharp
public static void SetUnityLicenseClientChannels(string channelName, string secondaryChannelName)
```

Parameters

| Type                                                           | Name                 | Description                                 |
| -------------------------------------------------------------- | -------------------- | ------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | channelName          | Channel name to which to connect.           |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | secondaryChannelName | Secondary channel name to which to connect. |

### StartServer

Start a Pixyz gRPC server.

```csharp
public void StartServer(string host, ushort port, bool blocking = true)
```

Parameters

| Type                                                           | Name     | Description                                                       |
| -------------------------------------------------------------- | -------- | ----------------------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | host     | Host address to bind to.                                          |
| [ushort](https://learn.microsoft.com/dotnet/api/system.uint16) | port     | Port to listen on.                                                |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | blocking | If true, blocks until server stops; if false, runs in background. |

### StartClient

Connect to a Pixyz gRPC server.

```csharp
public void StartClient(string host, ushort port)
```

Parameters

| Type                                                           | Name | Description                 |
| -------------------------------------------------------------- | ---- | --------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | host | Host address of the server. |
| [ushort](https://learn.microsoft.com/dotnet/api/system.uint16) | port | Port of the server.         |

### IsRemote

Returns true if the current session is a remote session (connected to a server).

```csharp
public bool IsRemote()
```

Returns

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