// ===== Private Functions. ===== /// <summary> /// Attempts to convert a given string value to a KeyCode. /// Returns a warning if unsuccessful. /// </summary> /// <param name="keyCodeString"> /// Value to be converted into KeyCode. /// </param> /// <returns> /// KeyCode conversion of input keyCodeString. /// Value is <c>KeyCode.None</c> if conversion is unsuccessful. /// </returns> private KeyCode TryKeyCodeConversion(string keyCodeString) { // Returning the result of parsing from strign to KeyCode if successful. if (KeyFormatter.TryParse(keyCodeString, out KeyCode result)) { return(result); } // Throwing a warning to the Unity console when parsing fails. else { Debug.LogWarning( $"Warning in {name} input settings:\n" + $"Could not convert '{keyCodeString}' to KeyCode. Defaulting to None." ); } // If end of function reached, parse has failed. // Return an empty KeyCode. return(KeyCode.None); }