I have a very simple class that wont compile because of a default parameter in the constructor. The language is C# and the class will be used in a Unity3d game. So this compile error is occurring in Unity's "IDE"
Compile Error:
Assets/Utilities/GenericClasses.cs(30,94): error CS1736: The expression being assigned to optional parameter `nName' must be a constant or default value
public class Element {
public static readonly string NULL_NAME = "___NULL_NAME___";
public enum elementType {E_ELEMENT, E_MODEL, E_VIEW, E_SUPER, E_ARC};
private string name;
private elementType type;
// line 30 is below
public Element(elementType nType=elementType.E_ELEMENT, string nName=NULL_NAME) {
type = nType;
name = nName;
}
}
What am I doing wrong?