Search Unity

Class name != file name when using dynamic boo eval

Discussion in 'Scripting' started by Morning, May 22, 2013.

  1. Morning

    Morning

    Joined:
    Feb 4, 2012
    Posts:
    1,141
    I'm messing with dynamic evaluation of boo and it works mostly fine but so far I can't figure out if it's possible to create and use MonoBehaviour classes that way.

    Code (csharp):
    1.  
    2.         interpreter.Eval("import UnityEngine");
    3.         interpreter.Eval("gs = GameObject.CreatePrimitive(PrimitiveType.Cube)");
    4.         interpreter.Eval(@"class BooItem(MonoBehaviour):
    5.     def Update():
    6.         Debug.Log('Boo updater')");
    7.         interpreter.Eval("gs.AddComponent[of BooItem]()");
    8.  
    The code's redundant but it's just for testing. I get:
    Since it evaluates from a string I have no idea if this can be solved at all.

    Trying my luck, maybe someone can help.