Scripts add interactive behaviors to objects in an experience. In Sansar, you can create, upload and add your own scripts in C#.
For more information on creating scripts for Sansar, read our API Documentation.
Alternatively, you may also find the API Documentation within the Sansar program folder. You can find the documentation on your system using the following file path: Program Files > Sansar > Client > Script API.
If you are interested in uploading scripts written in C# (.cs) to your inventory from your computer, see Uploading items in Sansar for a step-by-step guide on the upload process. Note that you will receive a warning if your script makes use of one of the Restricted APIs.
You can add scripts to objects in order to make them perform actions or interact with avatars and the environment. Currently, there are two ways to add a script to an object in a scene. For more information on these two ways, see Adding scripts to an object.
|Note: Some scripts, including the provided teleport scripts, require the object to be dynamic in order to properly track collision events. For more information about dynamic objects, see Making an object dynamic.|
Some scripts allow you to enter parameters to modify the way the script works. Each script is unique, so the name and function of parameters for each script may be different based on how it was defined by the script writer. For more information on setting a script's parameters, see Setting script parameters.
We have provided several example scripts in the Sansar client's install folder for you to use. You can find the example scripts by following the file path: Program Files > Sansar > Client > Script API > Examples. You can also find some documentation (and some download links) for some of these example scripts at Example Scripts in Sansar.