Пример #1
0
 /// <summary>
 /// Runs the code and catches any exceptions, logging them to the console.
 /// </summary>
 /// <param name="code">The code to run</param>
 /// <param name="parameters">The parameters for the scriptableCode</param>
 public static void SafeRun(ScriptableCode code, params object[] parameters)
 {   //Null catch
     if (!code)
     {
         return;
     }
     //Run in try catch
     try
     {
         code.Run(parameters);
     }
     catch (System.Exception e)
     {
         Debug.LogError("Scriptable Code '" + code.name + "' execute failed: " + e.ToString());
     }
 }
Пример #2
0
 /// <summary>
 /// Runs the code and catches any exceptions, logging them to the console.
 /// </summary>
 /// <param name="code">The code to run</param>
 /// <param name="parameters">The parameters for the scriptableCode</param>
 /// <returns>Returns default if the code fails or code is null</returns>
 public static T SafeRun <T>(ScriptableCode <T> code, params object[] parameters)
 {   //Null catch
     if (!code)
     {
         return(default);