Skip to content

PlayCanvas Integration

The PlayCanvas integration allows you to easily enable the built-in performance profiler and automatic gaze tracking.

Installation

In the PlayCanvas Editor, upload the following file from the SDK's /lib directory:

  • c3d-bundle-playcanvas.umd.js — A unified bundle containing the main SDK and the PlayCanvas adapter.

Initialization and Usage

In a PlayCanvas script component, you can now initialize the SDK and pass this.app to enable performance tracking.

var MyScript = pc.createScript('myScript');

MyScript.prototype.initialize = function() {
    // --- Cognitive3D Initialization ---
    // 1. Define your settings object
    const settings = { /* ... your APIKey and sceneId ... */ };

    // 2. Initialize the SDK, passing 'this.app' to enable the profiler
    const c3d = new C3D(settings, this.app);

    // 3. Initialize the PlayCanvas Adapter
    const c3dAdapter = new C3DPlayCanvasAdapter(c3d);

    // 4. Set your scene and user info
    c3d.setScene('MyPlayCanvasScene');
    c3d.setUserProperty("c3d.app.version", "0.2"); // REQUIRED PROPERTY, ensure this is set
    c3d.setUserProperty("c3d.deviceid", 'playcanvas_device_' + Date.now()); // REQUIRED PROPERTY, ensure this is set
    // ... set other user/device properties
};

Limitations

The following features are not currently supported with the PlayCanvas adapter:

  • Scene Export
  • Object Export
  • Dynamic Objects
  • Heatmaps

Note: The WebXR SDK is currently in development and we are working on new features. Support for the above may come later.

intercom If you have a question or any feedback about our documentation please use the Intercom button (purple circle) in the lower right corner of any web page or join our Discord.