WebGl and Eval()

Hi,

I am working on a Unity project developed in JS for the Unity WebPlayer, and that uses eval(), and I need to build it now for WebGl.

Eval() is not supported for the WebGl build. Is there any chance it’s going to ? Is their any easy way to work around the problem ?

I have seen posts about JSON.parse() or window.eval() but I have no idea what they are about.

Webgl Build can use ‘Application.Eval’.

It seems that Eval is not a member of Application.

Maybe you meant Application.ExternalEval, but that doesn’t work for me because the code is then excuted within the context of the wrapper html page. It needs to be evaluated within my object class, as the simple eval() did.

Did I miss something ?

I am not completely sure what’s your use-case, however, you may want to take a look at this page which explains your options when it comes to interact with Javascript.

Hi, is there any option to use a function like eval() for WebGL?
In my project i use code like this: (is working for Unity WebPlayer… but not for WebGL-Build)

function MyFunction(param : String){
…
js_command = js_command +“;”;
js_command = Regex.Replace(js_command, “(window.alert)+”, “create”);
eval(js_command);
…
}

I´am reading external-JS-Code and then eval() this within the unity-project. Is there an alternative for WebGL?

As was already written in this thread, Application.ExternalEval should do what you want.