添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
霸气的小虾米  ·  Uniting for Ukraine | ...·  5 月前    · 
忧郁的感冒药  ·  “Cloud Manager ...·  9 月前    · 
英俊的作业本  ·  PHP: cURL 函数 - Manual·  10 月前    · 

I’ve seen in the docs that I can communicate from my website with the unity app by sending messages:

SendMessage('MyGameObject', 'MyFunction', 'MyValue');  

but how can I send multiple values down to the function of that object using only one SendMessage?
Maybe that function needs several values…
Or can I pass some object and parse it with C#?

Thank you

So as it does not seem to be possible to send anything else than numbers and strings. The solution I came up with for now is sending a string with JS and then parsing it inside C#:

In Javascript Browser Code:
gameInstance.SendMessage(
    'Cylinder', 'HandleRotationString', '10|0|30'
In C# Unity Code:
void HandleRotationString(string coordinates) {
    string[] coord = coordinates.Split('|');
    float x = float.Parse(coord[0]);
    float y = float.Parse(coord[1]);
    float z = float.Parse(coord[2]);
    // ... use variables

I hope it helps someone.