Im trying to load and execute an script set via ScriptInstance component, in the editor. Im using this code:
[code]
if (node.HasComponent(“ScriptInstance”)){
scr = node.GetComponent(“ScriptInstance”);
}
if (scr !is null) {
if (!scr.Execute(“void ai_update()”))
Print(“Error executing”);
}[/code]
This is the code in the script:
void ai_update()
{
Print("AI script");
}
But Execute always returns false and the code is not executed. First i thought it was a parameter problem, because I made previous tests and it worked, but I started removing code and simplifying both the caller and the target code, and the error persists. Also, checked the ScriptInstance.ScriptFile contains the correct file name.
What can be wrong here?