Hi there,
I've been searching for a moment now, how to go back to line when the user press "enter" in a UIInput ?
I've found some answers here, but the solution you provided (the one you included in a release) don't work on my side.
Since nobody's complaining, I guess I did something wrong.
Maybe you could lighten me ?
else if (c == '\r' || c == '\n')
{
if (UICamera.current.submitKey0 == KeyCode.Return || UICamera.current.submitKey1 == KeyCode.Return)
{
// Not multi-line input, or control isn't held
if (!label.multiLine)// || (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)))
{
/*mText += "\n";
UpdateLabel();
return;*/
// Enter
current = this;
if (onSubmit != null) onSubmit(mText);
if (eventReceiver == null) eventReceiver = gameObject;
eventReceiver.SendMessage(functionName, mText, SendMessageOptions.DontRequireReceiver);
current = null;
selected = false;
return;
}
}
// If we have an input validator, validate the input first
if (validator != null) c = validator(mText, c);
// If the input is invalid, skip it
if (c == 0) continue;
// Append the character
if (c == '\n' || c == '\r')
{
if (label.multiLine) mText += "\n";
}
else mText += c;
// Notify the listeners
SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
}
Whatever I do, it always enter the
if (!label.multiLine || (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl))
multiLine is ok (I mean, going to be false only if "maxLine = 1"), but the 2 others break everything and I don't even get what and why they are. :s
Thanks in advance,
Cheers,
Abnaxus.