> For the complete documentation index, see [llms.txt](https://docs.viverse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.viverse.com/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code.md).

# Custom Code

The page introduces the basic information about implementing custom code with PlayCanvas in VIVERSE.

***

### Fundamentals

VIVERSE allows developers to use nearly any of the custom scripting interfaces [provided by PlayCanvas](https://developer.playcanvas.com/user-manual/scripting/), including but not limited to WebRequests like http & websockets, GLSL shaders, and 3rd party libraries imported directly into your project's hierarchy.

However, by default, VIVERSE's PlayCanvas SDK does automatically handles avatar transform and audio networking. For customizing any features related to the VIVERSE avatar, we provide an additional API reference (see VIVERSE SDK APIs below).

### VIVERSE SDK APIs

The documentation for VIVERSE's SDK APIs is currently housed here: <https://viveportsoftware.github.io/pc-lib/>. We provide interfaces for customizing the default VIVERSE Cameras, Player, Network, and Environment, as well as the unique attributes when in an XR/immersive session in a VR headset.

These interfaces are automatically injected when you activate the VIVERSE Chrome Extension; The folder @viverse is added to your asset folder, which contains all interfaces in the create-sdk.mjs file. All interfaces can be imported and manipulated in your custom scripts.

{% hint style="warning" %}
For accessing the APIs in the VIVERSE SDK, you must use .mjs file types, which support import and export statements.
{% endhint %}

### A Note on No-Code Tools

In addition to adding the create-sdk.mjs file on initialization, the VIVERSE Chrome Extension adds create-extensions-sdk.mjs, which contains all of the interfaces between the no-code tools and PlayCanvas.

Within this file, you can see that each no-code function is assigned a unique trigger string, such as 'trigger:300006' for EntitySubscribeTriggerEnter. This is useful, because you can arbitrarily listen for and fire these exact same event names in custom scripts, connecting together the VIVERSE No-Code Functions and your custom code.

### Read More

{% content-ref url="/pages/hZjwUZio5knMkojfXFSm" %}
[Connecting No-Code Events to Custom Scripts](/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code/connecting-no-code-events-to-custom-scripts.md)
{% endcontent-ref %}

{% content-ref url="/pages/USTQQvOPMnFnugqxxs5F" %}
[Introduction to MJS](/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code/introduction-to-mjs.md)
{% endcontent-ref %}

{% content-ref url="/pages/CKZzSprklzt9bF4DOmdu" %}
[Camera Management: Settings and Switching](/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code/camera-management-settings-and-switching.md)
{% endcontent-ref %}

{% content-ref url="/pages/0x91ZsXGiNDhHKoIbUlF" %}
[Custom Loading Screens](/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code/custom-loading-screens.md)
{% endcontent-ref %}

{% content-ref url="/pages/nkxEhsOkbamW7NsVtl7I" %}
[Change Avatars Programatically](/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code/change-avatars-programatically.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.viverse.com/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/custom-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
