Search Unity

Any way to clean Editor.log?

Discussion in 'Editor & General Support' started by zIyaGtVm, Aug 11, 2019.

  1. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    131
    Hi,
    I have a model with texuture. I want to see texture refresh in unity while painting the texture.png in Photoshop.
    We know that if we save the texture then back to unity , unity will reimport the texture and update it to model in scene. However this has a prerequisite : Unity window must be active:(
    I have to paint something then click unity window.

    Is there anyway to keep unity updating texture automatically while Unity window loses focus?

    I had tried to write a script like this:
    Code (CSharp):
    1. private void Update()
    2.     {
    3.  
    4.         if (tempTimer > frequency)
    5.         {
    6.             AssetDatabase.Refresh();
    7.             tempTimer = 0f;
    8.         }
    9.         else
    10.         {
    11.             tempTimer += Time.deltaTime;
    12.         }
    13.     }
    Everything worked fine until one day I found my harddisk is full.:confused:
    Because the "AssetDatabase.Refresh()" will write log message to Local\Unity\Editor\Editor.log which makes its size 120Gb after one day's work.

    Is it possible to clean Editor.log through script?
    Or is it possible to prevent logging "AssetDatabase.Refresh()" into log file?

    I tried these code below, however the Editor.log didn't get cleared.
    Code (CSharp):
    1. Type.GetType("UnityEditor.LogEntries,UnityEditor.dll")
    2.             .GetMethod("Clear", BindingFlags.Static | BindingFlags.Public)
    3.             .Invoke(null, null);
    4.  
    5. var assembly = Assembly.GetAssembly(typeof(UnityEditor.Editor));
    6.         var type = assembly.GetType("UnityEditor.LogEntries");
    7.         var method = type.GetMethod("Clear");
    8.         method.Invoke(new object(), null);
    Any advice would be greatly appreciated!:)
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
  3. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    131
    Peter77 likes this.