AntTweakBar.Variable.Variable C# (CSharp) Method

Variable() protected method

Creates a new variable in a given AntTweakBar bar.
protected Variable ( Bar parent, String>.Action initFunc, String def = null, bool initLabel = true ) : System
parent Bar The bar the variable should be created in.
initFunc String>.Action A delegate which will initialize the variable.
def String An optional definition string for the new variable.
initLabel bool Whether to initialize the variable's label.
return System
        protected Variable(Bar parent, Action<Variable, String> initFunc, String def = null, bool initLabel = true)
        {
            if ((parentBar = parent) == null) {
                throw new ArgumentNullException("parent");
            }

            Tw.SetCurrentWindow(ParentBar.ParentContext.Identifier);
            initFunc(this, id = Guid.NewGuid().ToString());
            created = true; /* Variable now created. */
            if (initLabel) Label = UnnamedLabel;
            ParentBar.Add(this);
            SetDefinition(def);
        }