D
D
Danil Afanasiev2017-10-18 20:51:53
In contact with
Danil Afanasiev, 2017-10-18 20:51:53

How to properly deintegrate json in Unity received with SendMessage?

Here is the code in index.html:

<script type="text/javascript">
  var script = document.createElement('SCRIPT');
   script.src = "https://api.vk.com/method/users.get?user_ids=210700286&fields=bdate&v=5.68&callback=callbackFunc";
   document.getElementsByTagName("head")[0].appendChild(script);
    function callbackFunc(result) {
    var name = result.response[0].first_name
    }
   </script>
    
  <script type = "text/javascript" language = "javascript" >
  function inform()
 {
  
 gameInstance.SendMessage('vkconnect', 'Prin', name)


 }
 </script>

Code in Unity C#:
public void Prin(string arg) 
{ 

//Textname.text = arg; 

}

How to correctly display the data received in json format?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2017-10-18
@danil_afan

You need to parse json into a format that is understandable to sharp. You can do this with the built-in JsonUtility , or you can download any of the million json parsers and use it. There is something on the Assett Store , but many parsers live on github or their own site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question