public static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions option)
 {
     if (IsLocked(assetPath))
     {
         Debug.LogError(string.Format("Could not delete {0} because it is locked!", assetPath));
         return(AssetDeleteResult.FailedDelete);
     }
     return(AssetDeleteResult.DidNotDelete);
 }
        public static int GetCount()
        {
            if (UnityEditorConsoleUtils._getCountMethod == null)
            {
                Debug.LogError("Failed to find LogEntries.GetCount method info!");
                return(0);
            }

            return((int)UnityEditorConsoleUtils._getCountMethod.Invoke(null, null));
        }
        public static void Clear()
        {
            if (UnityEditorConsoleUtils._clearMethod == null)
            {
                Debug.LogError("Failed to find LogEntries.Clear method info!");
                return;
            }

            UnityEditorConsoleUtils._clearMethod.Invoke(null, null);
        }
        public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath)
        {
            AssetMoveResult result = AssetMoveResult.DidNotMove;

            if (IsLocked(oldPath))
            {
                Debug.LogError(string.Format("Could not move {0} to {1} because {0} is locked!", oldPath, newPath));
                result = AssetMoveResult.FailedMove;
            }
            else if (IsLocked(newPath))
            {
                Debug.LogError(string.Format("Could not move {0} to {1} because {1} is locked!", oldPath, newPath));
                result = AssetMoveResult.FailedMove;
            }
            return(result);
        }
Exemplo n.º 5
0
        public static UnityScripsCompileTimeKeyframe Deserialize(string serialized)
        {
            string[] tokens = serialized.Split(UnityScripsCompileTimeKeyframe.kKeyframeDelimiterArray, StringSplitOptions.None);
            if (tokens.Length != 3)
            {
                Debug.LogError("Failed to deserialize CompileTimeKeyframe because splitting by " + UnityScripsCompileTimeKeyframe.kKeyframeDelimiter + " did not result in 3 tokens!");
                return(null);
            }

            UnityScripsCompileTimeKeyframe keyframe = new UnityScripsCompileTimeKeyframe();

            keyframe.elapsedCompileTimeInMS = Convert.ToInt32(tokens[0]);
            keyframe.serializedDate         = tokens[1];
            keyframe.hadErrors = Convert.ToBoolean(tokens[2]);

            return(keyframe);
        }
        public static UnityConsoleCountsByType GetCountsByType()
        {
            UnityConsoleCountsByType countsByType = new UnityConsoleCountsByType();

            if (UnityEditorConsoleUtils._getCountsByTypeMethod == null)
            {
                Debug.LogError("Failed to find LogEntries.GetCountsByType method info!");
                return(countsByType);
            }

            object[] arguments = new object[] { 0, 0, 0 };
            UnityEditorConsoleUtils._getCountsByTypeMethod.Invoke(null, arguments);

            countsByType.errorCount   = (int)arguments[0];
            countsByType.warningCount = (int)arguments[1];
            countsByType.logCount     = (int)arguments[2];

            return(countsByType);
        }
        public static string[] OnWillSaveAssets(string[] paths)
        {
            List <string> result = new List <string>();

            foreach (var path in paths)
            {
                if (IsUnlocked(path))
                {
                    result.Add(path);
                }
                else
                {
                    Debug.LogError(path + " is read-only.");
                }
                if (path.EndsWith(".unity"))
                {
                    Scene scene = SceneManager.GetSceneByPath(path);
                    Debug.Log("Currernt Save Scene :" + scene.name);
                }
            }
            return(result.ToArray());
        }