so before upgrading this code was work :
public static void Clear(){
Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll")
.GetMethod("Clear", BindingFlags.Static | BindingFlags.Public)
.Invoke(null,null);
}
but now with unity 2017 i get null ref exp and using more detailed code it gave clue :
static void ClearConsole () {
Assembly SampleAssembly = Assembly.GetAssembly(typeof(ActiveEditorTracker));
if (SampleAssembly == null)
{
Debug.LogError("!!! (SampleAssembly == null)");
}
else
{
Type type = SampleAssembly.GetType("UnityEditorInternal.LogEntries");
if (type == null)
{
Debug.LogError("!!! (type == null)"); // this one ??????????
}
else
{
MethodInfo method = type.GetMethod("Clear");
if (method == null)
{
Debug.LogError("!!! (method == null)");
}
else
{
method.Invoke(new object(), null);
}
}
}
}
so it looks the UnityEditorInternal.LogEntries is null why is that ?