I have a project, where you use a stacker. thats how it looks in the browser
I want to send Data from the C# code like the name of the selected object and so on, to the webgl index html to showcase the Data on the right side where the data table is.
I have already tried to use a jslib file but i could not really save the data i got, i could just show an alert with the name of the object i selected
this is my jslib code, where i tried it with alert.
mergeInto(LibraryManager.library, {
SendData: function (data){
window.alert(Pointer_stringify(data));
},
});
This is my C# code where i just send the name of the object to test it.
[DllImport("__Internal")]
private static extern void SendData(string data);
void OnMouseDown(){
string data = gameObject.name;
Debug.Log("Sending message to Js: "+ data);
#if UNITY_WEBGL && !UNITY_EDITOR
SendData(data);
#endif
}
I want to get Data into this table in the index.html
<table>
<tr>
<th class="type">Data</th>
<th>Value</th>
</tr>
<tr>
<td>Name:</td>
<td id="name"></td>
</tr>
<tr>
<td>ID:</td>
<td id="ID"></td>
</tr>
<tr>
<td>PNr:</td>
<td id="PNr"></td>
</tr>
<tr>
<td>Color:</td>
<td id="color"></td>
</tr>
</table>