# User Data

### User Class

The User class handles interactions user logins and logoffs.

### Syntax

### Member Details

#### AddUser Field

> For subscribing to events for users entering the scene
>
> #### Syntax
>
> public static readonly [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **AddUser**
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### RemoveUser Field

> For subscribing to events for users leaving the scene
>
> #### Syntax
>
> public static readonly [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **RemoveUser**
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### Subscribe Method

> Subscribes to User Events.
>
> #### Syntax
>
> \[Sansar.Script.Interface]\
> \[System.Obsolete("Use subscription callbacks of type Action\<Sansar.Simulation.UserData>", false)]\
> public [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Subscribe** ([string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) Action, [User.SubscriptionHandler](https://help.sansar.com/hc/en-us/articles/115003454726) callback, [bool](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean) persistent)
>
> **Parameters**
>
> > *Action*
> >
> > string action of the event: AddUser, RemoveUser
> >
> > *callback*
> >
> > Callback which is executed when the event completes.
> >
> > *persistent*
> >
> > Optional, set to false to unsubscribe after one event.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### Subscribe Method

> Subscribes to User Events.
>
> #### Syntax
>
> **See Also**
>
> **Parameters**
>
> > *Action*
> >
> > string action of the event: AddUser, RemoveUser
> >
> > *callback*
> >
> > Callback which is executed when the event completes.
> >
> > *persistent*
> >
> > Optional, set to false to unsubscribe after one event.
>
> **Returns**
>
> > An [Sansar.Script.IEventSubscription](/latest/script-api-docs/sansar-script-namespace/ievent-subscription.md) that can be used to cancel the subscription.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### Subscribe Method

> Subscribes to User Events.
>
> #### Syntax
>
> **Parameters**
>
> > *Action*
> >
> > string action of the event: AddUser, RemoveUser
> >
> > *User*
> >
> > Sansar.Script.SessionId for the user.
> >
> > *callback*
> >
> > Callback which is executed when the event completes.
> >
> > *persistent*
> >
> > Optional, set to false to unsubscribe after one event.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### Subscribe Method

> Subscribes to User Events.
>
> #### Syntax
>
> **See Also**
>
> **Parameters**
>
> > *Action*
> >
> > string action of the event: AddUser, RemoveUser
> >
> > *User*
> >
> > Sansar.Script.SessionId for the user.
> >
> > *callback*
> >
> > Callback which is executed when the event completes.
> >
> > *persistent*
> >
> > Optional, set to false to unsubscribe after one event.
>
> **Returns**
>
> > An [Sansar.Script.IEventSubscription](/latest/script-api-docs/sansar-script-namespace/ievent-subscription.md) that can be used to cancel the subscription.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

### User.SubscriptionHandler Delegate

Subscribe to receive events when users enter or leave the experience, or change their chat name.

### Syntax

\[Sansar.Script.Interface]\
\[System.Obsolete("Use subscription callbacks of type Action\<Sansar.Simulation.UserData>", false)]\
public delegate [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **User.SubscriptionHandler** ([string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) Action, [Sansar.Script.SessionId](https://help.sansar.com/hc/en-us/articles/115003551808) User, [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) Data)

**Parameters**

> *Action*
>
> string action of the event: AddUser, RemoveUser
>
> *User*
>
> Sansar.Script.SessionId for the user.
>
> *Data*
>
> Deprecated.

### Remarks

### Requirements

**Namespace:** Sansar.Simulation\
**Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
**Assembly Versions:** 1.1.0.0

### UserData Class

Subscribe to receive events when users enter or leave the experience.

### Syntax

### Member Details

#### Action Property

> string action of the event: AddUser, RemoveUser
>
> #### Syntax
>
> \[get: Sansar.Script.Interface]\
> public [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **Action** { get; }
>
> **Value**
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### Data Property

> Deprecated.
>
> #### Syntax
>
> \[get: Sansar.Script.Interface]\
> public [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **Data** { get; }
>
> **Value**
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### ToString Method

> A string representation of this object.
>
> #### Syntax
>
> \[Sansar.Script.Interface]\
> public override [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **ToString** ()
>
> **Returns**
>
> > A string representation of this object.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***

#### User Property

> Sansar.Script.SessionId for the user.
>
> #### Syntax
>
> **Value**
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Simulation\
> **Assembly:** Sansar.Simulation (in Sansar.Simulation.dll)\
> **Assembly Versions:** 1.1.0.0
>
> ***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sansar.com/latest/script-api-docs/sansar-simulation-namespace/user-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
