Assets/CustomInspectorCreator/Editor/Utilities/Compiler.cs
/// <summary>
/// Attempt to compile a csharp script (.cs) at the given path.
/// <para>Succesfull compilation will result in the return of the class's Type, else return null.</para>
/// </summary>
Attempt to compile a csharp script (.cs) at the given path.
Succesfull compilation will result in the return of the class's Type, else return null.
Attempt to compile a csharp script ( . cs ) at the given path . Succesfull compilation will result in the return of the class ' s Type else return null .
public Type GetTypeForCompiledClassAtPath(string path)
        {
            CompilerParameters parameters = CreateCompileParameters();
            CompilerResults results = LoadAndCompile(path, parameters);
            if (results.Errors.HasErrors)
            {
                foreach (var error in results.Errors)
                {
                    MessageLogger.ErrorCompileErrors(error);
                }
                MessageLogger.ErrorFailedToCompileClassAt(path);
                return null;
            }
            var type = GetType(results);
            return type;
        }
public Type GetTypeForCompiledClassAtPath ( string path ) { CompilerParameters parameters = CreateCompileParameters ( ) ; CompilerResults results = LoadAndCompile ( path , parameters ) ; if ( results . Errors . HasErrors ) { foreach ( var error in results . Errors ) { MessageLogger . ErrorCompileErrors ( error ) ; } MessageLogger . ErrorFailedToCompileClassAt ( path ) ; return null ; } var type = GetType ( results ) ; return type ; }
Attempt to compile a csharp script (.cs) at the given path.
Attempt to compile a csharp script ( . cs ) at the given path .
path
string