Using the Engine Standalone
It is possible to build applications on the PlayCanvas Engine without using the Editor. Some examples of applications built directly against the Engine are:
- glTF Viewer [GitHub]
- SuperSplat [GitHub]
- ...and, of course, the PlayCanvas Editor itself!
This page guides you in how to get started.
Before you begin, ensure you have Node.js installed.
When setting up your project, there are two main options to consider.
Option 1: Build Tool and NPM
This is the recommended set up that should suit most developers.
A build tool can bundle your application into an optimized package that can run on a wide range of browsers. There are many build tools such as webpack, Rollup and esbuild, and PlayCanvas will work with all of them. Here, we will use Vite, a popular build tool that aims to provide a faster and leaner development experience for modern web projects.
First, select whether you prefer to develop in JavaScript or TypeScript:
- JavaScript
- TypeScript
-
Open a Terminal/Command Prompt, create a folder for your app and
cd
inside it. -
Install
playcanvas
andvite
:npm install playcanvas vite --save-dev
-
Create an
index.html
and paste this:index.html<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
body { margin: 0; overflow: hidden; }
</style>
</head>
<body>
<script type="module" src="main.js"></script>
<canvas id='application'></canvas>
</body>
</html>