0.0.9 • Published 12 months ago

unity-cloudrendering-sdk v0.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

Unity云渲染 Javascript SDK

安装前准备

安装sdk

npm install --save unity-cloudrendering-sdk

使用参考

web端代码示例

    
const { Player, UGP_SDK_EVENTS } = require("unity-cloudrendering-sdk");

// 在网页的streaming-div节点下嵌入云渲染模块,分享id为02268d0fe356ef31
const player = new Player("02268d0fe356ef31" ,"streaming-div");

// 绑定LOADED事件
player.bind(UGP_SDK_EVENTS.LOADED, (msg) => {
  console.log('streaming loaded');  
})

// 绑定UGP_MESSAGE事件
player.bind(UGP_SDK_EVENTS.UGP_MESSAGE, (msg) => {
  console.log('receive message from remote');
})

// 从浏览器端发送自定义消息至
const sendBtn = document.getElementById("send-btn");
sendBtn.onclick = () => {
    player.postMessage('Hello Cloud Rendering');
};

unity端代码示例

using UnityEngine;

// 向浏览器端(JS SDK)发送消息
CloudStreaming.PostMessage("Hello Cloud Rendering");

// 接受浏览器端(JS SDK)发送来的消息
var sdkMessage = CloudStreaming.PeekMessage(); // 返回值为string类型
0.0.9

12 months ago

0.0.8

1 year ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago