Search Unity

Multiple errors in official 2D game kit

Discussion in 'Editor & General Support' started by kamoski, Jan 12, 2019.

  1. kamoski

    kamoski

    Joined:
    Jan 11, 2019
    Posts:
    4
    Hello, i recently tried to learn how unity works, and after doing few of smaller tutorials, like Tanks game or that one with Space I went for official 2D assets kit with Ellen.

    Problem itself:

    In script CheckForError, there is name "File" with no context. It appears 2 times in that script. I though that commenting it would solve the problem, but it eventually turned to produce even more errors.

    Console log errors (with that unspecified "File" specifier):
    https://imgur.com/a/5ZWfueK

    I'm using Unity 2017.3 v. (same problems appeared in unity 2018.1.6f)

    Is there way to make things right or should i just go for newest unity version and 3D pack?
    Which would be a shame as i was hoping for learning some 2D basics to do a game of my own concept.

    EDIT:
    I posted code for clarity.

    Code (CSharp):
    1. using System;
    2. using System.Reflection;
    3. using UnityEngine;
    4. using UnityEditor;
    5. using UnityEngine.Windows;
    6. using Object = UnityEngine.Object;
    7.  
    8. [InitializeOnLoad]
    9. public class CheckForError
    10. {
    11.     static CheckForError()
    12.     {    
    13.         if (File.Exists(Application.dataPath + "/../Library/CheckedForError"))
    14.             return;
    15.  
    16.         EditorApplication.update += EditorUpdate;
    17.     }
    18.  
    19.     static void EditorUpdate()
    20.     {
    21.         if (EditorApplication.isCompiling)
    22.             return;
    23.  
    24.         var logEntries = System.Type.GetType("UnityEditor.LogEntries,UnityEditor.dll");
    25.         var methods = logEntries.GetMethod("GetCountsByType", BindingFlags.Static|BindingFlags.Public);
    26.  
    27.         object[] arguments = { 0, 0, 0 };
    28.  
    29.         methods.Invoke(null, arguments);
    30.  
    31.         int errorCount = (int)(arguments[0]);
    32.  
    33.         if (errorCount > 0)
    34.         {
    35.             if (EditorUtility.DisplayDialog("Error", "Look like there is error in the project and that shouldn't happen on the first launch. Please, press ok to open the Unity forum to report your problem.", "Ok", "Cancel"))
    36.             {
    37.                 Application.OpenURL("https://forum.unity3d.com");
    38.             }
    39.         }
    40.        
    41.     File.WriteAllBytes(Application.dataPath + "/../Library/CheckedForError", new byte[]{0});
    42.         EditorApplication.update -= EditorUpdate;
    43.     }
    44. }
    45.  
    EDIT 2:
    Actually, evrything works just fine on unity 2018.3 v. but im still curious why older versions are so full of errors on this project.
     
    Last edited: Jan 12, 2019