跳到主要内容

SendMessageToSDK

描述

发送消息给sdk,消息可以是字符串或json。当这个方法被调用时,SDK这边的ReceivedMessage方法将收到发送的消息。

危险

只支持SDK 2.0.0-pre.12

方法

 public void SendMessageToSDK(string _data)

例子

Received.cs
using SDKEntry.Runtime;

public void Start(){
NativePlugins.Plugin.NativeAPI.OnMessageReceviedHandle += _str=>{
Debug.Log(_str);
};
}
XRExperience.cs
using SDKEntry.Runtime;

internal static API ARMODAPI = new API(nameof(Examlpe));
private void OnLoad(){
ARMODAPI.SendMessageToSDK("Hi, This message from XR-Experience!");
}