Change InputField decimal mark

The default decimal mark of a “Decimal Number” InputField is ‘.’
How do you change it to ‘,’ (comma) depending on the language?

Actually its pretty simple, or complicated, depending on how “accurate” you want to be. What you want would be Regular Expressions. the reason I say regular repressions is instead of just String.Replace is so you don’t just replace every “.” such as full stops to “,”.

Basically with decimals you have a a number after and before the decimal like this

0.2938498 or 111.348569

its up to you if you want to allow these

.03 0.999125

We wanbt to filer anything that isn’t either a number or a “,” / “.”
so either way your regular expression will look like this.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Text.RegularExpressions;

public class EURODecimalInput : MonoBehaviour {

    //Set thius to true if you want to use commas instead of fullstops
   public bool useComma = false;
 


  /// <summary>
  /// This will get called by the OnTextChanged Event
  /// Make sure you use the Dynamic Text version not the verison that will let you edit the string
  /// </summary>
  /// <param name="input"></param>
  public  void ValidateStringCharacters(string input)
    {
        //get out input feild, even though we just fired an event from it
        InputField InputField = GetComponent<InputField>();

        //assign our regular expression string, it will be different if you use commas hence the "if"
        string regexp = @"[^0-9\.]?";
        if (useComma)
        {
            //commas don't neeed escaping
            regexp = @"[^0-9,]?";
        }

      //Assign out regex Object
         Regex regex = new Regex(regexp);

        //Replace anything that isn't a number with empty
        input =  regex.Replace(input, "");


         //print(input);
         //Apply our Validated string
         InputField.text = input;

    }
}

OnValitadateString() is fired from the On Value Change event on your Input field.
You will also need to change your Input type to “Standard” or it will not work correctly.

Sorry for the confusion Earlier,

Hope it helps