public static bool IsVariableInvalid(AddVariableWindow addVariableWindow, string resultName, IElement currentElement, out string failureMessage) { bool didFailureOccur = false; string whyItIsntValid = ""; didFailureOccur = NameVerifier.IsCustomVariableNameValid(resultName, null, currentElement, ref whyItIsntValid) == false; failureMessage = null; if (didFailureOccur) { failureMessage = whyItIsntValid; } else if (addVariableWindow != null && NameVerifier.DoesTunneledVariableAlreadyExist(addVariableWindow.TunnelingObject, addVariableWindow.TunnelingVariable, currentElement)) { didFailureOccur = true; failureMessage = "There is already a variable that is modifying " + addVariableWindow.TunnelingVariable + " on " + addVariableWindow.TunnelingObject; } else if (addVariableWindow != null && IsUserTryingToCreateNewWithExposableName(addVariableWindow.ResultName, addVariableWindow.DesiredVariableType == CustomVariableType.Exposed)) { didFailureOccur = true; failureMessage = "The variable\n\n" + resultName + "\n\nis an expoable variable. Please use a different variable name or select the variable through the Expose tab"; } else if (ExposedVariableManager.IsReservedPositionedPositionedObjectMember(resultName) && currentElement is EntitySave) { didFailureOccur = true; failureMessage = "The variable\n\n" + resultName + "\n\nis reserved by FlatRedBall."; } return(didFailureOccur); }