I have my Input Field which only accepts decimal numbers and a button. What I want to do is when I press the button, the number in the Input Field would half. So for example if 100 is in the Input Field and I pressed the button, I would have 50 in the Input Field. I tried finding for a method but couldn’t.
In my program, my Input Field would be in the public slot and the script would be attached to an empty child which would then be placed in On Click() for the button to access the function.
With my code below, it says that “NullReferenceException: Object reference not set to an instance of an object”. Thank you in advance for any help available.
public InputField Value;
public void Half(float half){
Value.text = half * 0.5;
}