How to pass a float array huge from Browser to Unity?

In the index.html

SendMessage does not seem the right way …

Thanks & regards

Anything beyond simple objects like strings and floats needs some extra work.

There’s a couple of ways:

  1. Encode the float array into a string and pass it:
    “1.1,1.2,1.3”

It’s a bit of a memory hog if you have huge arrays you call often. You’ll also need some encoding/decoding logic. This is the simplest way for something quick that “just works”

  1. Any of the methods here if memory use is a concern are great:
    Unity - Manual: Interaction with browser scripting

We use both solutions in our current project.

1 Like