This guide provides step-by-step instructions for integrating PlayDeck into your Unity project. By following these steps, you'll be able to seamlessly set up and use PlayDeck in your project.
- Begin by copying the "Assets/PlayDeck" folder into your Unity project "Assets" directory.
- Open your start scene in Unity.
- Drag and drop prefab "PlayDeckBridge" from the "Assets/PlayDeck/Prefabs" to the first scene in your project.
- Integrate PlayDeck with your game using public methods from the "PlayDeckBridge".
- If you're using the provided custom WebGL template:
- Simply copy and paste "WebGLTemplate" folder into your "Assets". And that's all, skip next steps.
- If you are using your own custom WebGL template:
- Copy the
playDeckBridge.js
file to the same directory as yourindex.html
file.
- Copy the
- Adding the PlayDeck Script:
- Open your
index.html
file. - Inside the
<head></head>
tags, add the following line:<script src="playDeckBridge.js"></script>
- Open your
- Updating Unity Loading Code:
- Find the section in your
index.html
where Unity is loading (creating the Unity instance). - Update it using the following code example:
const playdeckBridgeInstance = playDeckBridge(); createUnityInstance(canvas, config, (progress) => { playdeckBridgeInstance?.setLoadingProgress(progress * 100) }).then(unityInstance => { playdeckBridgeInstance?.init(unityInstance); });
- Find the section in your
- After making these changes, save your
index.html
file. - Return to Unity, make and deploy build, test your project to ensure that PlayDeck is integrated and functioning correctly.
- This guide assumes a basic familiarity with Unity and web development.
- If you encounter any difficulties, you may contact us for additional help.