Ejemplo n.º 1
0
        /// <summary>
        /// Discards current instance of Evaluator, and CompilingResult, and replaces
        /// them with new ones. Also nullifies the AllREferencedAssemblies array
        /// </summary>
        public void Reset()
        {
            CompilationResult = new CompilingResult();

            CompilationOutput = new CompilerOutput();

            service = new MCS.Evaluator(new CompilerContext(new CompilerSettings(), CompilationResult));

            AllReferencedAssemblies = new List <Assembly>();
        }
 void ExecuteAppropriateDelegate(CompilerOutput tempOutput)
 {
     if (tempOutput.Errors.Count != 0)
     {
         if (OncompilationFailedDelegate != null)
         {
             OncompilationFailedDelegate(tempOutput);
         }
     }
     else
     {
         if (OncompilationSucceededDelegate != null)
         {
             OncompilationSucceededDelegate(tempOutput);
         }
     }
 }
        /// <summary>
        /// EXPERIMENTAL:
        /// Don't use this method with MonoBehaviours!
        /// MonoBehaviours will execute thier Updates in Unity Child Domain
        /// even if they were compiled, loaded and added in remote adpDomain
        /// That leads to unpredictable results when trying to execute Update() in remote appDomain.
        /// So right now using Update() message of dynamically compiled and added to GameObject MonoBehaviour in remote appDomain
        /// will result into crash on Unity Child Domain unload, and who knows what oddities and bugs.
        /// </summary>
        public void CompileType(string id, string code)
        {
            CompilerOutput tempOutput = GetRemoteExecutor.CompileType(id, code);

            ExecuteAppropriateDelegate(tempOutput);
        }