Interface error with eval()

Hi everyone,

I just need a little help. I’m currently creating a small “programming”-game which needs the player to create some little functions to complete the objectives.

The input is “sanitized” before everything else using a whitelist of available functions.

So now I want the code to execute in realtime in the scene. As I use UnityScript, I wanted to use the eval() function which, accordingly to various threads here and on the forums, works correctly with the webplayer.

But as I wrote down my line “eval(script)”, a big red mean error appeared on the console :

BCE0172: ‘UnityScript.Scripting.IEvaluationDomainProvider’
interface member implementation must
be public or explicit.

Without this line my game is completely useless and unplayable. So it would mean a lot to me if someone had a solution to fix this error and allowing the use of the eval() function.

Okay I have found where the problem is.

@Eric5h5 : Your exemple didn’t work at all in my projet and produced the same error. Even in a very new file with nothing in it… EXCEPT the line #pragma strict.

As soon as you delete this line, the error goes away and you can eval() your code. Not sure why disabling dynamic typing has something to do with eval() but well… I guess it’s why eval() doesn’t work on iOS, as #pragma strict is mandatory for this platform.

Now I have another problem (some functions in my eval()'d code aren’t called during the evaluation), but I have to dig in to see why.

Thank you both for your anwsers.