Everything works fine on the Editor.
On the webPlayer is quite strange.
I can do stuff like that :
var instance ;
instance =GameObject.Find("iGUI Root").GetComponent("iGUICode_POC_Neutre2_5");
instance.getInstance().winDocInfo_WIN.setEnabled(true);
But calling set function are not working such as that :
instance.getInstance().winDocInfo_WIN.label.text="Répeter la dernière consigne";
So it’s quite strange , because if i add a TestButton on a JS MonoBehaviour, i can call the set method (but of course it’s compiled code and not runtime code here).
The Error on the WebPlayerLog is :
Exception caught : CompilationErrorsException: script(2,49): BCE0055: Boo.Lang.Compiler.CompilerError: Internal compiler error: Attempt to access a private/protected method failed.. ---> System.MethodAccessException: Attempt to access a private/protected method failed.
Any idea how can i handle that? May i can only use function and not setter on dynamic JS eval code?
Thanks
I’ve run into exactly the same problem. If I try to access my variables from within an eval’d piece of code, it tells me I’m trying to access private/protected method:
CompilationErrorsException: script(1,30): BCE0055: Boo.Lang.Compiler.CompilerError: Internal compiler error: Attempt to access a private/protected method failed… —> System.MethodAccessException: Attempt to access a private/protected method failed.
I’ve simplified things down to the script below. I have a scene with just a camera, and I drop the script on it. That’s it – simple as can be.
It works fine in the editor, even with a web player target, but the actual web player throws an exception.
I think this may be an actual Unity bug.
#pragma strict
var result : String;
function Start()
{
var ht = {};
ht["one"] = 14;
var script = " ht[\"one\"] == 14 ";
if (eval(script))
result = "yes";
else
result = "no";
}
function OnGUI()
{
GUILayout.Label("result is " + result);
}
#pragma strict
var result : String = "unrun";
function Start()
{
result = ""+eval(" 7 == 12 "); // works in editor and web player
result = ""+eval(" \"seven\" == \"twelve\" "); // works in editor, not in web player
}
function OnGUI()
{
GUILayout.Label("the result is " + result);
}
Is anyone working on this? Am I posting in the wrong place?
I also got a problem with the Web-Player and the eval();
I´t seems not possible to access GameObjects and Functions, the only thing works are var : int
#pragma strict
var cube : GameObject;
function Start()
{
cube = GameObject.Find...;
}
function myFunction()
{
Debug.Log("yeah");
}
function Awake()
{
eval("myFunction();"); // Dont work anywhere
eval("cube.transform.position.x = 1;"); // Don't work in webplayer
}
Sry I just brought some more Questions and no Answers